##開檔案
jsp <- read.table("D:/Program Files/R/R-3.6.3/juniorSchools.txt", header=T , stringsAsFactor=F)
head(jsp)
## school class sex soc ravens pupil english math year
## 1 S1 C1 G 9 23 P1 72 23 0
## 2 S1 C1 G 9 23 P1 80 24 1
## 3 S1 C1 G 9 23 P1 39 23 2
## 4 S1 C1 B 2 15 P2 7 14 0
## 5 S1 C1 B 2 15 P2 17 11 1
## 6 S1 C1 B 2 22 P3 88 36 0
(直接打jsp會跑出3000多筆資料,不敢再這樣做了)
##把gender換成sex
jsp$Gender <- jsp$sex
##畫盒鬚圖另外換social class variable 的標籤
plot(x=jsp$soc, y=jsp$math)
lattice::bwplot(jsp$soc,jsp$math, data=jsp,
main="social class", xlab="soc", ylab="math")
## Warning in bwplot.numeric(jsp$soc, jsp$math, data = jsp, main = "social
## class", : explicit 'data' specification ignored
##存成RDA檔
saveRDS(jsp, file="D:/Program Files/R/R-3.6.3/juniorSchools.rda")