【发布时间】:2019-07-22 00:25:18
【问题描述】:
我希望在 R 中进行多个 t 检验,而不必复制粘贴每个测试。在查看“Level_#”时,每个测试将在“类型”(无论是“左”还是“右”)中是否存在差异。目前,我可能有:
t.test(Level_1 ~ Type, alternative="two.sided", conf.level=0.99)
t.test(Level_2 ~ Type, alternative="two.sided", conf.level=0.99)
Type Level_1 Level_2 Level_3
Left 17 50 98
Right 18 65 65
Left 23 7 19
Left 65 7 100
Right 9 13 17
问题是我有数百个“Level_#”,想知道如何自动化这个过程并输出结果的数据框。我的想法是以某种方式合并一个 apply 函数。
【问题讨论】:
标签: r dataframe hypothesis-test