悬赏 100 个论坛币 未解决
> data
t a c d
1 1 0 1 2
2 0 1 0 1
3 1 0 2 0
4 0 2 2 2
5 1 1 0 1
6 0 2 1 0
7 1 1 0 2
> chisq.test(t,a)
Pearson's Chi-squared test
data: t and a
X-squared = 4.2778, df = 2, p-value = 0.1178
> chisq.test(t,b)
Pearson's Chi-squared test
data: t and b
X-squared = 0.19444, df = 2, p-value = 0.9074
> chisq.test(t,c)
Pearson's Chi-squared test
data: t and c
X-squared = 0.19444, df = 2, p-value = 0.9074
我想问下如果列很多,如何同时进行第一列与第二列、第三列、...第n列的卡方检验,可否设计一个循环自己执行,不想每次都输入一次,列太多