R Dataset / Package plyr / baseball

How To Create a Barplot

Webform
The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

How To Create a Stacked Barplot

Webform
The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

How To Create a Pie Chart

Webform
The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

How To Compute the Mean

Webform
The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

How To Create a Plot

Webform
The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

How to Compute the Median

Webform
The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Boxplot

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Correlation Coefficient

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Cumulative Frequency Histogram

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Dotplot

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Hollow Histogram

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Numerical Summaries

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Pie Chart

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Plot

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Regression

Stem and Leaf Plots

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Visual Summaries

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.
Embed
<iframe src="https://embed.picostat.com/r-dataset-package-plyr-baseball.html" frameBorder="0" width="100%" height="307px" />
Attachment Size
dataset-89446.csv 1.5 MB
Dataset License
GNU General Public License v2.0
Documentation License
GNU General Public License v2.0
Dataset Help

On this Picostat.com 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.

Documentation

Yearly batting records for all major league baseball players

Description

This 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.

Usage

baseball

Format

A 21699 x 22 data frame

Variables

Variables:

  • id, unique player id

  • year, year of data

  • stint

  • team, team played for

  • lg, league

  • g, number of games

  • ab, number of times at bat

  • r, number of runs

  • h, hits, times reached base because of a batted, fair ball without error by the defense

  • X2b, hits on which the batter reached second base safely

  • X3b, hits on which the batter reached third base safely

  • hr, number of home runs

  • rbi, runs batted in

  • sb, stolen bases

  • cs, caught stealing

  • bb, base on balls (walk)

  • so, strike outs

  • ibb, intentional base on balls

  • hbp, hits by pitch

  • sh, sacrifice hits

  • sf, sacrifice flies

  • gidp, ground into double play

References

http://www.baseball-databank.org/

Examples

baberuth <- 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.

R Output Date
Picostat Output - Boxplot Apr 25, 2019