Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试一次对许多不同的列进行 T 检验,但不知道该怎么做。这是我对其中一列的内容,Clout.
Clout
t.test(wf[wf$ThreadID == 249001,]$Clout,wf[wf$ThreadID == 230005,]$Clout)
但我还有大约 20 个其他专栏,例如Authentic,Tone
Authentic
Tone
如何在所有列上运行此测试?
试试下面的。
n <- ncol(wf) inx1 <- which(wf$ThreadID == 249001) inx2 <- which(wf$ThreadID == 230005) ttest_list <- lapply(seq_len(n), function(j) t.test(wf[inx1, j], wf[inx2, j]))
注意:你怎么能确定有和 一样多的wf$ThreadID == 249001元素wf$ThreadID == 230005?
wf$ThreadID == 249001
wf$ThreadID == 230005