dta <- read.table("C:/Users/PARENTCARECHILDREN/Desktop/2020-04-13-Homework-2-Trellis/girlsGrowth.txt", header = T)
colnames(dta) <- c("Weight","Height","Head-butt","Head.circ","Chest.circ","Arm.len","Calf.len","Pelvis.circ","Age","ID")
head(dta)## Weight Height Head-butt Head.circ Chest.circ Arm.len Calf.len Pelvis.circ Age
## 1 1456 1025 602 486 520 157 205 170 4
## 2 1426 998 572 501 520 150 215 169 4
## 3 1335 961 560 494 495 145 214 158 4
## 4 1607 1006 595 497 560 178 218 172 4
## 5 1684 1012 584 490 553 165 220 158 4
## 6 1374 1012 580 492 525 158 202 167 4
## ID
## 1 S1
## 2 S2
## 3 S3
## 4 S4
## 5 S5
## 6 S6
年齡越大,體重、身高越大
library(lattice)
dta$Age <- as.factor(dta$Age)
dta$Weight <- round((dta$Weight/1000),0)
stripplot(Weight ~ Height | Age, groups=ID, data=dta, type=c('g','p'), xlab="Height", ylab="Weight/1000", auto.key=list(space="top", columns=6),alpha=.8,layout=c(4, 3))年齡越大,頭圍、身高越大
dta$Head.circ <- round((dta$Head.circ/50),0)
dotplot(Head.circ ~ Height | Age, groups=ID, data=dta, layout=c(3, 4), xlab="Height", ylab="Head.circ/50", auto.key=list(space="top", columns=6))年齡越大,胸圍越大
年齡越大,身高越高、手臂越長
不同年齡的身高密度長條圖
體重&身高的平行座標圖
綜合以上,隨著年齡越大.各項素質跟著變大