R/zzz.R

Defines functions .onAttach .onLoad

# ▄▄▄▄  ▄▄▄▄▄▄▄▄ .• ▌ ▄ ·. ▪  .▄▄ ·
# ▀▄  █·•██  ▀▄.▀··██ ▐███▪██ ▐█ ▀.
# ▐▀▀▀▄  ▐█.▪▐▀▀▪▄▐█ ▌▐▌▐█·▐█·▄▀▀▀█▄
# ▐█•  █ ▐█▌·▐█▄▄▌██ ██▌▐█▌▐█▌▐█▄▪▐█
# .▀  ▀  ▀▀▀  ▀▀▀ ▀▀  █▪▀▀▀▀▀▀ ▀▀▀▀

# zzz.R
# ::rtemis::
# 2016- EDG rtemis.org

# rtemis internal environment
live <- new.env()
live[["parallelized_learners"]] <- c(
  "BART",
  "LightGBM",
  "LightRF",
  "LightRuleFit",
  "LINADForest",
  "MLP",
  "Ranger",
  "TabNet"
)

# vars
rtemis_version <- utils::packageVersion("rtemis")

# `self` is injected by `torch::nn_module()` into the `initialize` and `forward`
# it builds a module from, so static analysis sees it as a free variable.
utils::globalVariables("self")

# References
# Unicode emojis: https://www.unicode.org/emoji/charts/full-emoji-list.html

.onLoad <- function(libname, pkgname) {
  .schema_catalog_cache[["ready"]] <- TRUE
  # S7
  S7::methods_register()
}

.onAttach <- function(libname, pkgname) {
  if (interactive()) {
    ncores <- default_n_workers(omit = 0L)
    vline <- paste0(
      "\n  .:",
      bold(pkgname),
      " v.",
      rtemis_version,
      " \Ub7 ",
      utils::sessionInfo()[[2]],
      " (",
      ncores,
      ngettext(ncores, " core", " cores"),
      " available)\n  "
    )
    packageStartupMessage(paste0(
      (),
      vline,
      fmt_gradient(
        paste0(rep("\u2500", nchar(vline) - 15L), collapse = ""),
        colors = c(
          rtemis_colors[["red"]],
          rtemis_colors[["orange"]],
          rtemis_colors[["red"]]
        )
      ),
      bold("\n  Resources"),
      "\n  \u2502    ",
      gray("Docs:"),
      " https://docs.rtemis.org/r/ml",
      "\n  \u2502 ",
      gray("Learn R:"),
      " https://pdsr.rtemis.org",
      "\n  \u2514    ",
      gray("Cite: "),
      rtcitation,
      "\n\n  ",
      fmt("PSA:", col = rtemis_colors[["red"]], bold = TRUE),
      " Do not throw data at algorithms. Compute responsibly!"
    ))
  } else {
    packageStartupMessage(
      paste0(
        "  .:",
        pkgname,
        " ",
        rtemis_version,
        " \U1F30A",
        " ",
        utils::sessionInfo()[[2]]
      )
    )
  }
}

Try the rtemis package in your browser

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

rtemis documentation built on Oct. 20, 2026, 1:06 a.m.