accessing sysdata.rda within package functions accessing sysdata.rda within package functions r r

accessing sysdata.rda within package functions


If your package name is somepackage and the object saved was nhanes_files with devtools::use_data(nhanes_files, internal = TRUE) then you can access this in your functions by calling somepackage:::nhanes_files.Pay attention, there're 3 : here.


I use myobject <- get0("myobject", envir = asNamespace("mypackage")).

This formulation passes R CMD CHECK. It is possible to change the name of the value, and it works to access objects in other loaded packages.