[英]R: Error in matrix(0, nrow = N, ncol = n.seq) : non-numeric matrix extent
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
不是數字。 是什么原因導致這種情況發生,我該如何解決?
如果你看一下在實例?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]
是從序列的距離i
在R
從序列j
在rankings
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.