我有兩個data.frames看起來像:柱配對統計檢驗
DF1
Col1 Col2 Col3 Col4
0.1854 0.1660 0.1997 0.4632
0.1760 0.1336 0.1985 0.4496
0.1737 0.1316 0.1943 0.4446
0.1660 0.1300 0.1896 0.4439
DF2
Col1 Col2 Col3 Col4
0.2456 0.2107 0.2688 0.5079
0.2399 0.1952 0.2356 0.1143
0.2375 0.1947 0.2187 0.0846
0.2368 0.1922 0.2087 0.1247
我想進行兩個data.frames之間並且具體地成對立柱之間wilcox.test,使得:
test1: between Col1 of DF1 and Col1 of DF2
test2: between Col2 of DF1 and Col2 of DF2
等等。
我用下面的腳本:
for (i in 1:length(DF2)){
test <- apply(DF1, 2, function(x) wilcox.test(x, as.numeric(DF2[[i]]), correct=TRUE))
}
不幸的是這個腳本的輸出是相同的測試的輸出不同方面使用以下腳本執行:
test1 = wilcox.test(DF1[,1], DF2[,1], correct=FALSE)
test2 = wilcox.test(DF1[,2], DF2[,2], correct=FALSE)
由於在實data.frames我有大約100列和200行(它們與維度相同)我無法按列創建測試列。
dput(DF1)
後:
structure(list(Col1 = c(0.1854, 0.1760, 0.1737, 0.1660,....), class = "data.frame", row.names = c(NA, -100L)))
同爲DF2
你能表現出可再現的格式的數據幀dput(DF2)'? – 2013-03-11 14:46:56