I am writing an R package which has internal variables stored in pkg/R/sysdata.rda. In the package, I have a function useVar(x)
that should recognise if the string x
is a variable name in sysdata.rda and if so return the corresponding variable.
What is best way(s) to do this?
Using :::
with strings
pkg:::var
would help me but only if var
can be specified as a string.
Listing internal variables
Another option would be to list the contents of sysdata.rda but I have not found a solution to this that feels right.
While this SO question is related, the answers are directed at package users rather than at package developers. Edit: I am assuming that internal variables should be called differently from within a package since they are not supposed to be seen by users.