[Rd] Including data in packages

Janko Thyson janko.thyson at ku-eichstaett.de
Thu Oct 14 21:06:48 CEST 2010

Dear List,


I would like to include a couple of objects in a package I am developing and
I don't really get it yet. The objects should be available after package
load as some functions depend on it.


I tried the following:


1)      Bundling all objects that I need in the file '/R/sysdata.rda' as
described in the "Writing R Extensions" manual on page 7

2)      Storing the objects in /inst/extdata/somedata.rda as described in
the "Writing R Extensions" manual on page 9

3)      Storing the objects in /data/somedata.rda to make it available via
data() later on (I would like these objects from the user, though. So this
isn't really my preferred option)


In DESCRIPTION I flagged 'LazyLoad' to 'yes'.


The thing is that I don't understand how the actual 'transfer' happens when
the package is build and installed. Where do the objects 'live' after
installation and how can I access them after firing library(mypackage)? For
example, there is a 'data' directory for package 'tm'
(R_HOME/R-2.11.1/library/tm) but such a directory is missing even if I chose
option 3) (as stated above) to get my data included. Also, how can I
actually execute the lazyload? 


Any hints are greatly appreciated!




More information about the R-devel mailing list