我尝试进行t.test,但它让我犯了这样的错误。
在R中使用t.test()时出错
没有足够的'x‘观察
数据只有数值,没有NA。分组的比例是10 : 35。如何规避这一点呢?提前感谢您的帮助!
t.test(data$Vrajdeb[data$a=="1"],data$Vrajdeb[data$a=="2"])
data https://1drv.ms/x/s!ApJwAUaohJFdr1ID-QebKTmE_o3K的
引用
发布于 2018-05-28 07:43:03
您有足够的观察值,但您无法根据列'a‘设置数据子集。这是因为导入数据时第一个列名为Unicode:<U+430>
对于字符'a',请为列'a‘使用索引1或将其重命名为
colnames(data)[1] <- 'a'
然后运行t测试。
发布于 2018-05-28 05:52:57
这里有一种方法可以做到。请注意,当我将数据加载到中时,标记为a
的列显示为X.
library(dplyr)
library(broom)
> data
# A tibble: 45 x 25
X. Cinizm Agres Vrajdeb Zavisim Motiv Stimul Igra Rasslab Podderjka_1
<int> <int> <int> <int> <int> <int> <int> <int> <int> <int>
1 1 33 22 17 1 7 6 7 13 15
2 1 54 38 24 3 8 13 4 13 8
3 1 44 35 21 6 8 11 10 14 6
...
> data %>% do(tidy(t.test(Vrajdeb~X., data=.)))
estimate estimate1 estimate2 statistic p.value parameter conf.low
conf.high method alternative
1 -1.728571 17.3 19.02857 -0.8999865 0.3819658 15.42225 -5.812628
2.355486 Welch Two Sample t-test two.sided
https://stackoverflow.com/questions/50556441
复制相似问题