I want to create a sparse matrix of type "dgCMatrix" using the Matrix package
(and the matrix must be of this type even if other more compact representations
may exist). I do
> library(Matrix)
> m1<-Matrix(rep(1,4),nrow=2,ncol=2,sparse=T)
> m1
2 x 2 sparse Matrix of class "dsCMatrix"
[1,] 1 1
[2,] 1 1
To convert m1, I do
> as(m1, "dgCMatrix")
2 x 2 sparse Matrix of class "dgCMatrix"
[1,] 1 1
[2,] 1 1
Is it possible to construct a dgCMatrix "directly" i.e. without going through
the additional as() step above?
Best regards
Søren
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.