[R-pkg-devel] referring to a package data object by two names

Gregory Jefferis jefferis at gmail.com
Sun Oct 8 14:45:42 CEST 2017


Dear Michael,

Many thanks for writing.

> Do any of the suggestions in section 1.5.3 of Writing R Extensions "Load hooks" work?

I thought I had tried all the various permutations in .onLoad but at your prompting I tried some more and this seems to work:

.onLoad <- function (libname, pkgname) {
  # set up default landmarks object
  assign('landmarks',
         envir = parent.env(environment()),
         testdataalias::landmarks.2017)

}

It doesn't seem to tickle R CMD check, but I'm not yet convinced that it is 100% safe. Any comments either way are welcome!

Best wishes,

Greg.



More information about the R-package-devel mailing list