[R] Problems with e1071 and SparseM

Christian Holler decoder at wjpserver.cs.uni-sb.de
Sun Jul 8 13:55:07 CEST 2007

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,



Christian Holler
System Administrator

Chair of Prof. Dr. W.J. Paul
Saarland University
Building E1 3, Room 3.20

phone: +49 - 681 / 302 - 5537
fax:   +49 - 681 / 302 - 4290

More information about the R-help mailing list