如何熔化R中的60k x 60k矩阵

时间:2016-07-25 08:21:31

标签: r matrix melt

当我使用melt包的reshape2函数用R融化60k x 60k矩阵(即只有数值)时,我得到以下错误:

>melt(m)

Error in if (n > 0) c(NA_integer_, -n) else integer() :    missing value
where TRUE/FALSE needed Calls: melt ... <Anonymous> -> melt.matrix ->
expand.grid -> .set_row_names In addition: Warning messages: 1: In rep.fac * nx
: NAs produced by integer overflow 2: In .set_row_names(as.integer(prod(d)))
:   NAs introduced by coercion to integer range 
Execution halted

对于较小的(例如20k x 20k)矩阵,不会出现误差,因此我假设它与矩阵大小有关。还有其他方法可以快速融化矩阵吗?

我也试过

melt = data.frame(row = c(row(m)), col = c(col(m)), value = c(m))

但这导致类似的错误

Error in if (mirn && nrows[i] > 0L) { : 
  missing value where TRUE/FALSE needed
Calls: data.frame
In addition: Warning message:
In structure(value, row.names = row.names, class = "data.frame") :
  NAs introduced by coercion to integer range
Execution halted

0 个答案:

没有答案