wush978 / FeatureHashing

Implement feature hashing with R
GNU General Public License v3.0
97 stars 38 forks source link

CSCMatrix to dgMatrix not working with plain R command script #129

Open tongjiyiming opened 5 years ago

tongjiyiming commented 5 years ago

my script is cat_train <- hashed.model.matrix( f, as.data.table(cat_train), HASHING_DIM_ ) I got

Error in as(retval, "dgCMatrix") : 
  no method or default for coercing “CSCMatrix” to “dgCMatrix”

when I run it in a command line terminal with plain R script environment. But, the code works inside Rstudio.

Please check

wush978 commented 5 years ago

Please add:

library(methods)

at the beginning of your script and try again.