[R-pkg-devel] referring to a package data object by two names
Dear Greg Do any of the suggestions in section 1.5.3 of Writing R Extensions "Load hooks" work? Michael
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 landmarks.2016 landmarks.2017 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: https://github.com/jefferis/testdataalias 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 http://www2.mrc-lmb.cam.ac.uk/group-leaders/h-to-m/g-jefferis http://jefferislab.org http://www.zoo.cam.ac.uk/departments/connectomics
______________________________________________ R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel --- This email has been checked for viruses by AVG. http://www.avg.com