R Dataset / Package plyr / baseball
Documentation |
---|
On this R-data statistics page, you will find information about the baseball data set which pertains to Yearly batting records for all major league baseball players. The baseball data set is found in the plyr R package. You can load the baseball data set in R by issuing the following command at the console data("baseball"). This will load the data into a variable called baseball. If R says the baseball data set is not found, you can try installing the package by issuing this command install.packages("plyr") and then attempt to reload the data. If you need to download R, you can go to the R project website. You can download a CSV (comma separated values) version of the baseball R data set. The size of this file is about 1,569,282 bytes. Yearly batting records for all major league baseball playersDescriptionThis data frame contains batting statistics for a subset of players collected from http://www.baseball-databank.org/. There are a total of 21,699 records, covering 1,228 players from 1871 to 2007. Only players with more 15 seasons of play are included. Usagebaseball FormatA 21699 x 22 data frame VariablesVariables:
Referenceshttp://www.baseball-databank.org/ Examplesbaberuth <- subset(baseball, id == "ruthba01") baberuth$cyear <- baberuth$year - min(baberuth$year) + 1calculate_cyear <- function(df) { mutate(df, cyear = year - min(year), cpercent = cyear / (max(year) - min(year)) ) }baseball <- ddply(baseball, .(id), calculate_cyear) baseball <- subset(baseball, ab >= 25)model <- function(df) { lm(rbi / ab ~ cyear, data=df) } model(baberuth) models <- dlply(baseball, .(id), model) -- Dataset imported from https://www.r-project.org. |
Title | Authored on | Content type |
---|---|---|
OpenIntro Statistics Dataset - dream | August 9, 2020 - 12:25 PM | Dataset |
OpenIntro Statistics Dataset - winery_cars | August 9, 2020 - 2:38 PM | Dataset |
R Dataset / Package HSAUR / toothpaste | March 9, 2018 - 1:06 PM | Dataset |
R Dataset / Package HSAUR / pottery | March 9, 2018 - 1:06 PM | Dataset |
R Dataset / Package HistData / Guerry | March 9, 2018 - 1:06 PM | Dataset |
Attachment | Size |
---|---|
dataset-89446.csv | 1.5 MB |