inst/startup.R

# Project-level setup
R_version <- "4.1.3" # Set up project R version
snapshot <- "2021-08-31" # Set up snapshot date
repos <- paste0("https://packagemanager.posit.co/cran/", snapshot) # Set up repository based on snapshot

home <- normalizePath(".") # Set up home directory
while (!"DESCRIPTION" %in% list.files(home)) {
  home <- dirname(home)
}

# A&R folder path (Do not edit information below)
path <- list(
  home = "", # Project home
  adam = "adam", # ADaM data
  output = "output" # Output
)

path <- lapply(path, function(x) file.path(home, x))

# Define repo URL for project-specific package installation
options(repos = repos)

# Check R version
if (paste(R.version$major, R.version$minor, sep = ".") != R_version & interactive()) {
  stop("The current R version is not the same with the current project in ", R_version)
}

# Repository
message("Current project R package repository:")
message(paste0("    ", getOption("repos")))
message(" ")

# Display R session status
# message("R packages were installed from repo: ", options('repo'), "\n")
message(
  "Below library paths are searched in order to find installed R pacakges in this R session:", "\n",
  paste(paste0("    ", .libPaths()), collapse = "\n")
)
message("\n")

message("The project home directory is ", home)
message("\n")

rm(home, R_version)
RConsortium/submissions-pilot1 documentation built on Feb. 25, 2024, 6:14 a.m.