November 29th, 2016

Remember

Read data with

birth <- read.table("http://anaraven.github.io/static/birth.txt", header=TRUE)

Graphics depend on the type of data

Numeric v/s Numeric

plot(head ~ weight, data=birth)

Factor v/s Factor

birth$apgar5 <- as.factor(birth$apgar5)
plot(sex ~ apgar5, data=birth)

Factor v/s Numeric

plot(sex ~ weight, data=birth)

Numeric v/s Factor

plot(weight ~ sex, data=birth)

Boxplot

Plotting a numeric value depending on a factor results in a boxplot

It is a graphical version of summary().

  • The center is the median
  • The box is between the first and third quartile (50% of cases)
  • The whiskers extend a prediction of 95% of cases
  • Points are outliers

Nicer boxplot

plot(weight ~ sex, data=birth, boxwex=0.2, notch=TRUE, col="grey")

Exploring all data

plot(birth)