openintro (version 1.3)

MLB: Salary data for Major League Baseball (2010)

Description

Salary data for Major League Baseball players in the year 2010.

Usage

data(MLB)

Arguments

source

Collected from the following page (and its linked pages) on February 23rd, 2011:

http://content.usatoday.com/sportsdata/baseball/mlb/salaries/team

Examples

Run this code
data(MLB)

#=====> Basic Histogram <=====#
hist(MLB$salary/1000, main="", breaks=15, xlab="Salary (millions of dollars)", axes=FALSE, ylab="", col="#22558844")
axis(1, seq(0, 40, 10))
axis(2, c(0, 500))
axis(2, seq(100, 400, 100), rep("", 4), tcl=-0.2)

#=====> Histogram on Log Scale <=====#
hist(log(MLB$salary/1000), main="", breaks=15, xlab="log(Salary)", axes=FALSE, ylab="", col="#22558844")
axis(1) #, seq(0, 40, 10))
axis(2, seq(0, 300, 100))

#=====> Box plot of log(salary) against position <=====#
par(las=1, mar=c(4, 8, 1, 1))
boxPlot(log(MLB$salary/1000), MLB$position, horiz=TRUE, ylab="")

Run the code above in your browser using DataLab