Skip to content
Prev 17862 / 21312 Next

[Bioc-devel] Methods to speed up R CMD Check

Hey Herv?,

Thanks for this it is very helpful and I'm very sorry but I have one more question, where to put option 3? I thought making an onload r script for it:

.onLoad <- function(libname, pkgname) {
  .my_internal_global_variables <- new.env(parent=emptyenv())

  .get_eh <- function() get("eh", envir=.my_internal_global_variables)
  .set_eh <- function(value) assign("eh", value,
                                    envir=.my_internal_global_variables)

  toto <- function()
  {
    eh <- try(.get_eh(), silent=TRUE)
    if (inherits(eh, "try-error")) {
      eh <- ExperimentHub()
      .set_eh(eh)
    }
    eh
  }

  toto()
}

This seems to work in that the script runs (I can tell based on the output with devtools::check()) but I still get an error that eh doesn't exist in my test functions.

Kind regards,
Alan.