> library(nutshell)
載入需要的程輯包:nutshell.bbdb
載入需要的程輯包:nutshell.audioscrobbler
> data("toxins.and.cancer")
> attach(toxins.and.cancer)
> plot(total_toxic_chemicals/Surface_Area,deaths_total/Population)
> identify(total_toxic_chemicals/Surface_Area,deaths_total/Population,State_Abbrev)
[1] 3 8 16
給所有點加標(biāo)簽text()
> text(total_toxic_chemicals/Surface_Area,deaths_total/Population,
+ labels=State_Abbrev,cex=0.5,adj=c(0,-1))
求相關(guān)系數(shù)
> cor.test(total_toxic_chemicals/Surface_Area,deaths_total/Population)
Pearson's product-moment correlation
data: total_toxic_chemicals/Surface_Area and deaths_total/Population
t = 1.8909, df = 39, p-value = 0.06609
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
-0.01961007 0.54853523
sample estimates:
cor
0.2897887
> data("batting.2008")
> pairs(batting.2008[batting.2008$AB>100,c("H","R")])
多個變量逐對比較的散點圖
>pairs(batting.2008[batting.2008$AB>100,c("H","R","SO","BB","HR")])
這里是選擇出屬性AB>100的運動員恕汇,然后兩兩比較他們在"H","R","SO","BB","HR"這五項中的得分。