Question: This is a R Programming Question from the book Modern Data Science with R. Exercise 5.2 Write a function called count_seasons() that, when given a

This is a R Programming Question from the book Modern Data Science with R.

Exercise 5.2

Write a function called count_seasons() that, when given a teamID, will count the number of seasons the team played in the Teams data frame from the Lahman package.

library(Lahman)

attach(Teams)

Here is the Code I have so far but the Function is not working:

This is a R Programming Question from the book Modern Data Science

Rtuio | | Environment History Gobal Ene rannn 2 ibr ary(Lahmar libr ay 4 library(lyr eadTears) o attath Tear) -function(x, tearrate) [ 13 Count (Teans, teanID 21 apply(bktearo. count-season iles Plats Facages Help Viewer Hone Sep 25, 2017, 11:03 AM schneider 16 56 NA NA 4a 256 137 4.95 27 0 747 329 5 1 23 225 NA 0,838 D's ton Red tock ings 2 22 218 NA 0.829 Chicago white ockings 4 17 163 NA 0.80 Fort Wayne Kekio"gas 5 22 22? NA 0.839 6 16 191 NA 0.85 Philadelphia Athetics New York Hutuas NA 10 S8 Na 101 102 Na S6 100 Na 101 107 Na SO 88 NA 102 8 Sauth Ennl Grurkls T llanilton Field

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!