我计算得到了行指标indi、列指标indj和对应位置的数值inds(长度均为n*K),
使用spparseMatrix建立稀疏矩阵的命令为:
W <- sparseMatrix(i=indi, j=indj, x=inds, dims=c(n,n))
报错如下:
Error in checkAtAssignment("dgTMatrix", "x", "matrix") :
assignment of an object of class “matrix” is not valid for @‘x’ in an object of class “dgTMatrix”; is(value, "numeric") is not TRUE
4 stop(gettextf("assignment of an object of class %s is not valid for @%s in an object of class %s; is(value, \"%s\") is not TRUE",
dQuote(valueClass), sQuote(name), dQuote(cl), slotClass),
domain = NA)
3 checkAtAssignment(structure("dgTMatrix", package = "Matrix"),
"x", "matrix")
2 sparseMatrix(i = indi, j = indj, x = inds, dims = c(n, n)) at SimGraph_NearestNeighbors.R#47
1 SimGraph_NearestNeighbors(data, 10, 1)
请教一下诸位大神,这是什么情况。。。我没搞明白


雷达卡




京公网安备 11010802022788号







