[R] Problems with e1071 and SparseM

David Meyer david.meyer at wu-wien.ac.at
Mon Jul 9 23:54:35 CEST 2007


yes, this is indeed a bug (in predict.svm) - will be fixed in the next 
release of e1071.

Thanks for pointing this out,



Hello all,

I am trying to use the "svm" method provided by e1071 (Version: 1.5-16)
together with a matrix provided by the SparseM package (Version: 0.73)
but it fails with this message:

 > > model <- svm(lm, lv, scale = TRUE, type = 'C-classification', kernel =
Error in t.default(x) : argument is not a matrix

although lm was created before with read.matrix.csr (from the e1071)

I also tried to simply convert a normal matrix to a SparseM matrix and
then pass it, but I get the same error again.

According to the manual of svm(), this is supposed to work though:

"       x: a data matrix, a vector, or a sparse matrix (object of class
           'matrix.csr' as provided by the package 'SparseM').    "

Used R version: R version 2.4.0 Patched (2006-11-25 r39997)

Does anyone know how I can use Sparse Matrices with e1071? This would be
really important because the matrix is simply too large to write it out.

Best regards,


More information about the R-help mailing list