运行某个程序得到的结果中有参数beta,stored as a sparse matrix (dgCMatrix class),想将其转化成正常格式的matrix,试着用了as.matrix(beta)但是不行,而且is.vector(beta)显示TRUE,但是beta明明就是sparse matrix啊;或者有什么办法可以直接知道sparse matrix beta中那些行是非零行吗?(就是这一行不是全为0的)
大概的结果是这样的,每个tuning parameter对应一个beta结果,下面这个beta是第6个tuning paramter所对应的结果
> as.matrix(beta)
[,1]
6 ?
其中(省略了下面的行)
> beta
$6
150 x 2 sparse Matrix of class “dgCMatrix”
delta1 delta2
V1 0.00000000 0.00000000
V2 0.05358010 -0.89286558
V3 0.04931754 -0.61671995
V4 0.01930617 -0.13256372
V5 0.00000000 0.00000000
V6 0.00000000 0.00000000
V7 0.00000000 0.00000000
V8 0.89758848 -0.06769596
V9 0.90525795 -0.03567307
V10 0.00000000 0.00000000
V11 0.00000000 0.00000000
V12 0.00000000 0.00000000
V13 0.00000000 0.00000000
V14 0.00000000 0.00000000
V15 0.00000000 0.00000000