R/zzz.r

Defines functions r_check_limit_cores .onLoad .onAttach

.onAttach <- function(libname, pkgname) {
  rnorm(1); # force RNG seed initialisation (not done when the RNG is called from C++ code)
  if(r_check_limit_cores())
    setThreadOptions(1)
}

.onLoad <- function(libname, pkgname) {
  rnorm(1); # force RNG seed initialisation (not done when the RNG is called from C++ code)
  if(r_check_limit_cores())
    setThreadOptions(1)
}


# note : Il se pourrait qu'au lieu de renvoyer "true" certains systèmes renvoient "true " ou quelque chose comme ça
# le plus simple semble etre de tester que c'est défini (à autre chose que "false" au cas où, admettons)...
r_check_limit_cores <- function() { 
  Rcheck <- tolower(Sys.getenv("_R_CHECK_LIMIT_CORES_", ""))
  (nchar(Rcheck[1]) > 0) & (Rcheck != "false")
}

Try the Ravages package in your browser

Any scripts or data that you put into this service are public.

Ravages documentation built on Oct. 19, 2021, 5:07 p.m.