R/92_zzz.R

Defines functions register_s3 .onLoad

.onLoad <- function(...) {

  register_s3("coda", "as.mcmc", "bm")
  register_s3("coda", "as.mcmc", "bm")
  invisible()
}

register_s3 <- function(pkg, generic, class) {

  fun <- get(paste0(generic, ".", class), envir = parent.frame())
  stopifnot(is.function(fun))

  if(pkg %in% loadedNamespaces()) {
    registerS3method(generic, class, fun, envir = asNamespace(pkg))
  }

  setHook(packageEvent(pkg, "onLoad"), function(...) {
    registerS3method(generic, class, fun, envir = asNamespace(pkg))
  })
}

Try the bsreg package in your browser

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

bsreg documentation built on March 18, 2022, 5:36 p.m.