2019 データ解析基礎論A DAA04

```dat<- read.csv("http://www.matsuka.info/data_folder/datWA01.txt")
plot(dat\$shoesize, dat\$h, main="Relationship b/w shoesize and height",
xlab = "shoesize", ylab="height", pch=19, col="red")
txt = paste("r =", round(cor(dat\$shoesize,dat\$h), 4))
text(22, 175, txt, cex = 1.5)
abline(h = mean(dat\$h), col='blue');
abline(v = mean(dat\$shoesize), col='darkgreen');
text(x = 21, y = mean(dat\$h)+3,
paste("mean height =", round(mean(dat\$h),2)),

text(x = mean(dat\$shoesize)+0.2, y = 145,
paste("mean shoesize =", round(mean(dat\$shoesize),2)),

abline(lm(dat\$h~dat\$shoesize), lty=2, lwd=2)

plot(dat[dat\$gender=='F',]\$shoesize, dat[dat\$gender=='F',]\$h,
main="Relationship b/w shoesize and height", xlab='shoesize', ylab='height',
cex.lab=1.5, pch=19, col='blue', xlim=c(20,29), ylim=c(140,190))
plot(dat[dat\$gender=='M',]\$shoesize, dat[dat\$gender=='M',]\$h,
main="Relationship b/w shoesize and height", xlab='shoesize', ylab='height',
cex.lab=1.5, pch=15, col='green', xlim=c(20,29), ylim=c(140,190))

plot(dat[dat\$gender=='F',]\$shoesize, dat[dat\$gender=='F',]\$h,
main="Relationship b/w shoesize and height", xlab='shoesize', ylab='height',
cex.lab=1.5, pch=19, col='blue', xlim=c(20,29), ylim=c(140,190))
points(dat[dat\$gender=='M',]\$shoesize,dat[dat\$gender=='M',]\$h,
pch = 15, col = 'green')
legend("topleft", c('Female','Male'), pch =c(19,15),
col = c('blue','green'), cex = 1.5)