Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Object not found after installing and loading package

Tags:

r

I've thrown together a bunch of my utility functions into a package. However, I can't seem to access them after I've installed the package. I get errors of the form Error: object 'function_name' not found

  1. Building the package, there are no error messages
  2. Installing the package from source, there are no error messages
  3. Loading the package, there are no error messages (library() nor require())
  4. The package documentation is accessible once loaded
  5. I'm using roxygen2 to generate documentation and the namespace

Any thoughts?

like image 645
Brandon Bertelsen Avatar asked Feb 23 '23 11:02

Brandon Bertelsen


2 Answers

Do you use a NAMESPACE and forgot to add the object in question?

If you're using roxygen2, have you remembered to add #' @export function_name to the functions you want included in the namespace?

like image 150
Dirk Eddelbuettel Avatar answered Feb 25 '23 11:02

Dirk Eddelbuettel


If the function name is not exported, you may need to use ":::"

pkgname:::function_name

I believe that CRAN now requires a NAMESPACE, and I think R 2.14.x may even require them.

like image 44
IRTFM Avatar answered Feb 25 '23 13:02

IRTFM