rpackage-development

devtools::use_data( , internal =TRUE)


I want to use an array, say aaa, as internal data by devtools::use_data( aaa,internal =TRUE).

But this command make only one file sysdata.rda. Why ? Why several internal data files does not be allowed to exist?.

I also cannot understand the difference between internal =TRUE and FALSE.

My motivation of using internal =true is a default value of some variable of my function in my package. I want to use some array as a default values, and this default values is not needed for users of my package, hence I consider the array should be included my package as an internal =TRUE . Is this attitude correct ?

And the R says that use usethis::use_data() instead of devtools::use_data(). Why ???

REF: R package: writing internal data, but not all at once


Solution

  • devtools::use_data has now been deprecated and transferred to the usethis package, hence the message; the functions remains the same.

    If you set internal = TRUE the data will only be accessible by functions of the package internally while if FALSE the data will be exported, users will be able to load it with data("aaa").

    There is no need for multiple files, you can save multiple variables in a single file, i.e.: usethis::use_data(cars, mtcars).