felixr / sparsity

R package with functions for sparse matrices
3 stars 6 forks source link

Error: not compatible with requested type trying to write svmlight #1

Open dkincaid opened 7 years ago

dkincaid commented 7 years ago

Trying to write a sparse matrix that was created using the text2vec package and getting an error about a type problem.

> write.svmlight(dtm_train, rownames(dtm_train), "/tmp/pd.svm")
Error in write.svmlight(dtm_train, rownames(dtm_train), "/tmp/pd.svm") : 
  not compatible with requested type
> class(dtm_train)
[1] "dgCMatrix"
attr(,"package")
[1] "Matrix"
dselivanov commented 7 years ago

Second argument should be numeric vector of target variable.