Learn R Programming

Lahman (version 3.0-1)

SchoolsPlayers: SchoolsPlayers table

Description

Information on schools players attended, by player

Usage

data(SchoolsPlayers)

Arguments

source

Lahman, S. (2014) Lahman's Baseball Database, 1871-2013, 2014 version, http://baseball1.com/statistics/

Examples

Run this code
data(SchoolsPlayers)
head(SchoolsPlayers)

## Q: What are the top universities for producing MLB players?
SPcount <- table(SchoolsPlayers$schoolID)
SPcount[SPcount>50]

library('lattice')
dotplot(SPcount[SPcount>50])
dotplot(sort(SPcount[SPcount>50]))

## Q: How many schools are represented in this dataset?
length(table(SchoolsPlayers$schoolID))

# Histogram of the number of players from each school who played in MLB:
with(SchoolsPlayers, hist(table(schoolID), xlab = 'Number of players',
                           main = ""))

Run the code above in your browser using DataLab