根據剎車距離與車速數據,輸出他們關係圖函數
data(cars) attach(cars) j=1 par(mai=c(0.9, 0.9, 0.6, 0.3)) for(i in c("p","l","b","c","o","h","s","S","n")) { plot(speed,dist,type=i, main = paste("type=\"",i,"\"",sep="")) if(i=="S") i="S2" fileName = paste("carPlot_",j,i,sep = "") savePlot(filename = fileName, type="png") j=j+1 } detach()
根據年齡、身高、體重輸出他們之間關係的多組圖spa
df<-data.frame( Age = c(13, 13, 14, 12, 12, 15, 11, 15, 14, 14, 14, 15, 12, 13, 12, 16, 12, 11, 15),
Height = c(144,166,163,143,152,169,130,159,160,175,161,170,146,159,150,183,165,146,169),
Weight = c(38.1,44.5,40.8,34.9,38.3,50.8,22.9,51.0,46.5,51.0,46.5,60.3,37.7,38.1,45.1,68.0,58.1,38.6,50.8)
)
pairs(df)
savePlot(filename="Pairs_Age_Weight_Height",type="png")