When we want to store multiple internal objects in a package, we should use a R/sysdata.rda file. The tool usethis::use_data (when using internal = TRUE) simply creates a list of the passed objects (argument ...) and stores them in such a file. I'm concerned with the loading of this R/sysdata.rda file.
The book "Writing R Extensions" states:
Two exceptions are allowed: if the R subdirectory contains a file sysdata.rda (...) this will be lazy-loaded into the namespace environment – this is intended for system datasets that are not intended to be user-accessible via
data.
The book "R Packages" states:
The
LazyDatafield in the packageDESCRIPTIONhas no impact onR/sysdata.rdabut is strictly about the exported data belowdata/. Internal data is always lazy-loaded.
However, internal data being lazy-loaded might mean two things:
- When one of the objects in that file is needed, the complete file is loaded.
- When one of the objects in that file is needed, only that object is loaded.
Which one of this statements is the correct one?
Thanks