[R] no method for coercing this S4 class to a vector

Sam Steingold sds at gnu.org
Mon Nov 5 18:40:25 CET 2012


all of a sudden, after a SparseM upgrade(?)
I get this error:
> str(z)
Formal class 'matrix.csr' [package "SparseM"] with 4 slots
  ..@ ra       : num [1:85372672] -0.4288 0.0397 0.0104 -0.1843 -0.1203 ...
  ..@ ja       : int [1:85372672] 1 2 3 4 5 6 7 8 9 10 ...
  ..@ ia       : int [1:699777] 1 123 245 367 489 611 733 855 977 1099 ...
  ..@ dimension: int [1:2] 699776 122
> z1<-as.matrix(z)
Error in as.vector(data) : 
  no method for coercing this S4 class to a vector
> z1<-scale(z)
Error in as.vector(data) : 
  no method for coercing this S4 class to a vector

what has happened?
how do I scale the matrix.csr object (to be written to a file)?

PS. write.matrix.csr is very slow: it takes
    user   system  elapsed
1137.058  510.615 1649.925
to write the matrix "z" above.

thanks!

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://thereligionofpeace.com
http://iris.org.il http://jihadwatch.org
A year spent in artificial intelligence is enough to make one believe in God.



More information about the R-help mailing list