Internal data in sysdata.rda visible to end user?

Hello,

I'm developing a personal package for a side hobby of mine. It's the first package I develop but thanks to the R packages online book, it's been quite benign. The only thing that's driving me crazy is this: I have some internal data I use for some functions, which I save on R/sysdata.rda. If I got it right, that should be visible to my functions (and it seems to be) but not to the end user when the package is loaded. And yet, when I load the library after installing it, I'm able to see the internal variables. I assume there must be something wrong on my understanding of this topic. My objective is to keep this data internal and hidden to the user when the library is loaded.

The code and package can be found on: https://github.com/rpg-tips/RPGTips and it should be installable using devtools.

Thanks in advance!

I think this is because you use the default NAMESPACE

This will export any object matching the regex in the package: all the function in the R directory and your internal data in the rda file.

I would advice to build the namespace using roxygen2, following advices here

  • use @export in documentation for function you want to export
  • Only the data in data will be exported to user using data() on your package.
  • Your internal data won't be documented so no export roxygen tag.
  • use this devtools::document() to build the namespace.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.