尝试以下方法:
> dput(Matrix(newmatrix))
new("dgeMatrix"
, x = c(-0.705193264426589, 0.68023073271425, 0.0726318059033283, -0.111055227906436,
-0.113940777963113, 0.726463241417717, -0.343435098646076, 0.885225942372688,
-0.549848405897803, -0.0227469387867766, -0.927524398860002,
0.58047674424687, 0.521144348439824, 0.279602090928527, -1.31686400403363,
0.906874499735628, -0.276997805548975, 0.632960950203858, 0.453881309098762,
-0.00528540521655077)
, Dim = 4:5
, Dimnames = list(NULL, NULL)
, factors = list()
)
> dput(newmatrix)
structure(c(-0.705193264426589, 0.68023073271425, 0.0726318059033283,
-0.111055227906436, -0.113940777963113, 0.726463241417717, -0.343435098646076,
0.885225942372688, -0.549848405897803, -0.0227469387867766, -0.927524398860002,
0.58047674424687, 0.521144348439824, 0.279602090928527, -1.31686400403363,
0.906874499735628, -0.276997805548975, 0.632960950203858, 0.453881309098762,
-0.00528540521655077), .Dim = 4:5)
显然这些不是相同的数据结构。