Box Plots

Description

The following R command calculates side-by-side box plots comparing the career home runs for Ruth, DiMaggio, and Bonds for each season that they played in major league baseball.

To use R in a Sage cell, the language must be set to R. See https://github.com/sagemath/sagecell/blob/master/doc/embedding.rst for details.

Sage Cell

Code

ruth <- c(22, 25, 34, 35, 41, 41, 46, 46, 46, 47, 49, 54, 54, 59, 60)
bonds <- c(16, 25, 24, 19, 33, 25, 34, 46, 37, 33, 42, 40, 37, 34, 49, 73, 46, 45, 45, 5, 26, 28)
dimaggio <- c(12, 14, 20, 21, 25, 29, 30, 30, 31, 32, 32, 39, 46)
boxplot(ruth, bonds, dimaggio, names=c("Ruth", "Bonds", "DiMaggio"), main="Comparing Homerun Seasons")

Options

None

Tags

Primary Tags: statistics

Secondary Tags: box plots

Related Cells

Attribute

Permalink:

Author: T. Judson

Date: 19 Jul 2017 12:05

Submitted by: Tom Judson

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License