Reading data

birth <- read.table("../../../static/birth.txt", header=TRUE)
summary(birth)
##        id            birth           apgar5      sex         weight    
##  Min.   : 4199   Min.   :1.000   Min.   :1.000   F:299   Min.   :1100  
##  1st Qu.: 6112   1st Qu.:1.000   1st Qu.:8.000   M:395   1st Qu.:2972  
##  Median : 7920   Median :1.000   Median :9.000           Median :3250  
##  Mean   : 7877   Mean   :1.677   Mean   :8.281           Mean   :3244  
##  3rd Qu.: 9606   3rd Qu.:2.000   3rd Qu.:9.000           3rd Qu.:3580  
##  Max.   :11475   Max.   :3.000   Max.   :9.000           Max.   :5000  
##       head           age            parity          weeks      
##  Min.   :34.0   Min.   :22.00   Min.   :1.000   Min.   :26.00  
##  1st Qu.:48.0   1st Qu.:33.50   1st Qu.:1.000   1st Qu.:38.00  
##  Median :50.0   Median :34.50   Median :2.000   Median :39.00  
##  Mean   :49.3   Mean   :34.42   Mean   :2.611   Mean   :38.75  
##  3rd Qu.:51.0   3rd Qu.:35.50   3rd Qu.:4.000   3rd Qu.:40.00  
##  Max.   :55.0   Max.   :42.00   Max.   :9.000   Max.   :42.00

Number of cases

nrow(birth)
## [1] 694

Initial graphics

plot(head ~ age, data = birth)

plot(head ~ age, data = birth, subset = sex=="F")

plot(head ~ age, data = birth, subset = sex=="M")

Corrected graphics

plot(head ~ age, data = birth)

plot(head ~ age, data = birth, subset = sex=="F", xlim=range(age), ylim=range(head))

plot(head ~ age, data = birth, subset = sex=="M", xlim=range(age), ylim=range(head))

Final graphics

plot(head ~ age, data = birth, main="Baby head size v/s Mom's age", xlab="Age [years]", ylab="Head cicumference [cm]")

plot(head ~ age, data = birth, subset = sex=="F", xlim=range(age), ylim=range(head), main="Baby head size v/s Mom's age", xlab="Age [years]", ylab="Head cicumference [cm]", sub="Girls")

plot(head ~ age, data = birth, subset = sex=="M", xlim=range(age), ylim=range(head), main="Baby head size v/s Mom's age", xlab="Age [years]", ylab="Head cicumference [cm]", sub="Boys")

Different colors or shapes

plot(head ~ age, data = birth, main="Baby head size v/s Mom's age", xlab="Age [years]", ylab="Head cicumference [cm]", col=sex)

plot(jitter(head) ~ jitter(age), data = birth, main="Baby head size v/s Mom's age", xlab="Age [years]", ylab="Head cicumference [cm]", col=sex)