如何在R中的一列中跨多个组进行t检验? [英] How do I make a t-test across several groups in one column in R?
本文介绍了如何在R中的一列中跨多个组进行t检验?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想问你,当我有一个包含组级别的列和一个具有这样的值的列时,如何在R中执行t检验:
I'd like to kindly ask you, how to perform a t-test in R when I have a column with the group levels and a column with the values like this:
group value
north 1.1
north 1.6
north 1.4
east 1.3
east 1.5
east 1.7
south 1.2
south 1.5
south 1.8
west 1.6
west 1.7
west 1.9
获得这样的结果:
north east south west
north p-value p-value p-value
east p-value p-value p-value
south p-value p-value p-value
west p-value p-value p-value
我在互联网上搜索了很多内容,但发现的描述仅针对两个组或不同列中的组.我无法想象,这是一个如此罕见的问题.通常,科学家必须比较两个以上的组,以查看哪些组之间存在显着差异.
I searched a lot in the internet but the descriptions that I have found were for only two groups or for groups in different columns. I can't imagine, that this is such a rare issue. It should be common that scientists have to compare more than two groups to see which groups are significantly different from each other.
感谢您的帮助和问候
推荐答案
我们可以尝试使用pairwise.t.test
pairwise.t.test(df1$value, df1$group)$p.value
这篇关于如何在R中的一列中跨多个组进行t检验?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文