2015-07-19 109 views
0
library(RMallow) 
> dput(rankings) 
structure(list(MEMORY1 = c(5.5, 7, 1.5, 6, 4.5, 4.5, 5, 4, 1, 
5.5, 2.5, 4.5, 2.5, 5.5, 4, 1, 4, 5, 2.5, 5.5), MEMORY2 = c(5.5, 
3, 1.5, 6, 4.5, 4.5, 5, 4, 5, 5.5, 6.5, 4.5, 2.5, 5.5, 4, 7, 
8, 5, 6.5, 5.5), MEMORY3 = c(5.5, 3, 4.5, 2, 4.5, 4.5, 5, 4, 
5, 1.5, 6.5, 4.5, 6.5, 5.5, 4, 7, 4, 5, 6.5, 5.5), MEMORY4 = c(1.5, 
3, 4.5, 2, 1, 4.5, 5, 4, 5, 5.5, 2.5, 4.5, 2.5, 1.5, 4, 2, 4, 
5, 2.5, 1.5), MEMORY5 = c(5.5, 3, 4.5, 6, 4.5, 4.5, 5, 1, 5, 
5.5, 6.5, 4.5, 6.5, 5.5, 4, 4, 4, 5, 2.5, 1.5), MEMORY6 = c(5.5, 
7, 7.5, 6, 8, 4.5, 5, 7.5, 5, 5.5, 6.5, 4.5, 6.5, 5.5, 4, 4, 
4, 5, 2.5, 5.5), MEMORY7 = c(1.5, 3, 4.5, 2, 4.5, 4.5, 1, 4, 
5, 1.5, 2.5, 4.5, 6.5, 1.5, 4, 7, 4, 1, 6.5, 5.5), MEMORY8 = c(5.5, 
7, 7.5, 6, 4.5, 4.5, 5, 7.5, 5, 5.5, 2.5, 4.5, 2.5, 5.5, 8, 4, 
4, 5, 6.5, 5.5)), .Names = c("MEMORY1", "MEMORY2", "MEMORY3", 
"MEMORY4", "MEMORY5", "MEMORY6", "MEMORY7", "MEMORY8"), row.names = c(NA, 
20L), class = "data.frame") 

abils = ncol(rankings) 
R = Rgen(2, hyp = NULL, abils) 
AllKendall(ranking, R) 

當我運行上面的代碼,我得到說的錯誤Error in matrix(0, nrow = N, ncol = n.seq) : non-numeric matrix extent。我讀了幾個其他相關的帖子,它似乎是問題是nrow = N是不是數字。是什麼導致了這種情況發生,我該如何解決?R:在矩陣的錯誤(0,nrow = N,NcoI位= n.seq):非數字矩陣程度

回答

0

如果您在?AllKendall看看例子看來,你的「設置序列」應該是一個矩陣(看他們如何有排名的名單,然後他們rbind在一起?)

對此效果,嘗試

AllKendall(do.call(rbind, R), do.call(rbind, rankings)) 
# for some reason if you put it the other way round there is an error 

,其結果是一個矩陣使得output[i, j]是從序列iR從序列jrankings的距離。