[R-pkg-devel] referring to a package data object by two names
lists at dewey.myzen.co.uk
Sun Oct 8 13:34:56 CEST 2017
Do any of the suggestions in section 1.5.3 of Writing R Extensions "Load
On 08/10/2017 08:40, Gregory Jefferis wrote:
> Dear R colleagues,
> I have a set of versioned data objects in a package. Let's call them
> I need to have access to both of these objects for different calculations both internal to the package and for end users. The objects are saved as rda files in the package's data folder.
> I would also like to define an object – an alias if you will – that contains the *current* landmarks. This is useful so that some package functions and external scripts do not require editing when the default object changes.
> For this, somewhere in the package, I would like to do something like:
> # set the current default landmarks
> landmarks <- landmarks.2017
> I cannot figure out a place to do this in my package because check always complaints that landmarks.2017 does not exist – I guess lazy loading can only happen after all the R code is evaluated.
> * Can anyone suggest a workaround that does not involve saving a third redundant rda object into the package's data folder?
> I have placed a toy example package on GitHub:
> With many thanks,
> Greg Jefferis.
> Gregory Jefferis, PhD
> Division of Neurobiology
> MRC Laboratory of Molecular Biology
> Francis Crick Avenue
> Cambridge Biomedical Campus
> Cambridge, CB2 OQH, UK
> R-package-devel at r-project.org mailing list
> This email has been checked for viruses by AVG.
More information about the R-package-devel