我有一個數據框有4列和679行,我需要使用genefilter包中的da函數rowttest執行ttest。想要列出兩個第一列和另外兩列。如何在R中執行rowttest?
A_R1 A_R2 B_R1 B_R2
1 2 7 7
4 5 8 7.5
5 5 9 NA
6 5 10 NA
...
我使用了這段代碼,但我並不確定「fac」是什麼意思。我認爲這是行數。
#t.test is the dataframe used
ttest2=na.omit(ttest)
rowttests(as.matrix(ttest2),fac=679,tstatOnly = FALSE)
我有這樣的錯誤:
Error in function (classes, fdef, mtable) :
unable to find an inherited method for function ‘rowttests’ for signature ‘"matrix", "numeric"’
或
Error in rowcoltt(x, factor(integer(ncol(x))), tstatOnly, 1L) :
Invalid argument 'x': must be a real matrix.
有人能幫助我嗎?
謝謝,但存在的問題之一是這個錯誤: 錯誤rowcoltt(X,FAC,tstatOnly,1L): 無效參數 'X':必須是一個真正的矩陣。 我轉換矩陣中的data.frame。我不明白 – 2013-02-27 09:54:01
是的,但我無法幫助,因爲我沒有在您的問題中看到x的定義。 – agstudy 2013-02-27 09:58:42
x是上面顯示的表 – 2013-02-27 10:01:58