[R-pkg-devel] How do I enable to show data in inst/extdata in data() || lazy load
Ivan Krylov
kry|ov@r00t @end|ng |rom gm@||@com
Mon Dec 19 21:25:35 CET 2022
On Mon, 19 Dec 2022 20:59:27 +0530
Sanjeev Sariya <sanjeevsariya using gmail.com> wrote:
> ... I have created a .Rd file.
> I'm interested in listing this file in data() ...
My understanding is that data() is for R-level objects, and so is
help(), most likely.
One way to solve this could be to write a script that imports the file
from inst/extdata using the facilities provided by your package and put
it in a file under data/, then document the resulting object. I think
that if you build your package with --no-resave-data, it will remain an
R script that will be run during the data() call. (By default, your R
script will be run during R CMD build and its output will be packaged
into a gzip-compressed RData file.)
This might go against the guidance at
<https://cran.r-project.org/doc/manuals/R-exts.html#Data-in-packages>,
which says:
>> R code should be if possible “self-sufficient” and not make use of
>> extra functionality provided by the package, so that the data file
>> can also be used without having to load the package or its namespace
Do you need this to be a file? Could it be a pre-parsed R object
instead?
--
Best regards,
Ivan
More information about the R-package-devel
mailing list