Open
Description
Following @gaborcsardi's advice in https://stat.ethz.ch/pipermail/r-devel/2017-January/073647.html, I tried memoising in .onLoad()
, and it worked for me:
# file.R
fun <- function() {
some_expensive_process()
}
# zzz.R
.onLoad <- function(pkgname, libname) {
fun <<- memoise::memoise(fun)
}
This eliminates the build-time dependency on memoise and also gets rid of R CMD check
warnings about using memoise without importing it.
I wonder if and where we should document this.