Skip to content

Instantly share code, notes, and snippets.

@even4void
Last active May 27, 2025 11:39
Show Gist options
  • Save even4void/99e40b772ec84b82eaef9bd2e5de0ace to your computer and use it in GitHub Desktop.
Save even4void/99e40b772ec84b82eaef9bd2e5de0ace to your computer and use it in GitHub Desktop.
Old R stuff from years ago
R_LIBS_USER="~/.local/lib/R/library"
R_PROFILE="~/.config/R/Rprofile"
RENV_CONFIG_USER_PROFILE=TRUE
RENV_PATHS_ROOT="~/.cache/org.R-project.R/R/renv"
options(menu.graphics = FALSE)
options(width = 100, tibble.width = 100)
options(editor = "nvim")
options(languageserver.rich_documentation = FALSE)
options(error = function() traceback(3))
makeActiveBinding(".__", function() .Last.value, .GlobalEnv)
.libPaths(c(
.libPaths(),
"/Users/chl/.local/lib/R/languageserver/renv/library/macos/R-4.4/aarch64-apple-darwin20"
))
## RNG monitor (https://is.gd/ahZeuk)
if (interactive()) {
invisible(addTaskCallback(local({
last <- .GlobalEnv$.Random.seed
function(...) {
curr <- .GlobalEnv$.Random.seed
if (!identical(curr, last)) {
msg <- "NOTE: .Random.seed changed"
if (requireNamespace("crayon", quietly = TRUE)) msg <- crayon::blurred(msg)
message(msg)
last <<- curr
}
TRUE
}
}), name = "RNG tracker"))
}
.First <- function() {
grDevices::quartz.options(width = 6, height = 6)
grDevices::palette("Tableau10")
}
.Last <- function() {
if (interactive()) {
hf <- Sys.getenv("R_HISTFILE")
if (hf == "") hf <- "~/.local/state/R_history"
savehistory(hf)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment