How do I call the new function in R when the object is defined in another package?

Viewed 52

Suppose I'm creating a package and I'd like to define a function that creates an object where the object is defined in another package.

For example: get_empty_mtx <- function() return(new("dgCMatrix"))

If I type library(Matrix), this will work, but when I'm making my own package, I like to use :: when referencing things from other packages. I can't do Matrix::new("dgCMatrix") as new is not a function from the Matrix package.

1 Answers
Related