Hi,

I'd like to reshape a sparse matrix generated from the Matrix package.  I can't 
seem to do it with the command

dim(A) <- c(6,9)

which works perfectly with the base package matrices, but with the sparse 
matrices it errors with

Error in dim(A) = c(6, 9) : dim<- : invalid first argument

Manipulating the Dim attribute of the sparse Matrix does not produce the 
desired effect. [EMAIL PROTECTED] <- c(as.integer(9),as.integer(6)) does not 
produce a column ordering result, which I am assuming is because the data is 
stored in a row (i) and column (j) format instead (class dgTMatrix)

Does a function for this exist?

-Scott

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to