zdebruine / RcppML

Rcpp Machine Learning: Fast robust NMF, divisive clustering, and more
GNU General Public License v2.0
89 stars 15 forks source link

Example code is broken, need to run library(RcppML) first #36

Closed Wainberg closed 1 year ago

Wainberg commented 1 year ago

I'm using the latest development version of RcppML, installed via devtools::install_github("zdebruine/RcppML"). When I ran the example code:

A <- Matrix::rsparsematrix(1000, 100, 0.1) # sparse Matrix::dgCMatrix
model <- RcppML::nmf(A, k = 10, nonneg = TRUE)

I got the error:

Error in Rcpp_nmf_sparse(data, mask_matrix, tol, maxit, getOption("RcppML.verbose"),  :
  Expecting a single value: [extent=0].

However, it works fine if you load the library first:

library(RcppML)
A <- Matrix::rsparsematrix(1000, 100, 0.1)
model <- RcppML::nmf(A, k = 10, nonneg = TRUE)  # or: model <- nmf(A, k = 10, nonneg = TRUE)
zdebruine commented 1 year ago

Thanks! Example updated to reflect the need to load the library first. More docs to follow as well.