对于内置矩阵ToothGrowth:
tooth.1mg <- subset(ToothGrowth,dose==1)
tt <- t.test(len~supp,tooth.1mg,alternative="two.sided",
+ var.equal=FALSE,conf.level=0.95)
如何len~supp运作?符号~表示什么?
为什么我不能写supp~len
?
对于内置矩阵ToothGrowth:
tooth.1mg <- subset(ToothGrowth,dose==1)
tt <- t.test(len~supp,tooth.1mg,alternative="two.sided",
+ var.equal=FALSE,conf.level=0.95)
如何len~supp运作?符号~表示什么?
为什么我不能写supp~len
?
这就是它对公式界面的作用。另请参阅?t.test。
应该清楚这一点和错误消息为什么supp~len不能工作 -rhs公式的 应该是一个分类变量,即 a factor,恰好有两个类别(并且lhs是每个类别中的值)。