data-raw/prepare_simulations.R

# prepare system for running simulations by downloading packages
# if they are missing

cran_packages <- c("remotes", "progress", "usethis", "SparseM", "e1071", "packrat")
github_packages <- c("jolars/rdatasets")

# configure R to use R_LIBS_USER folder for packages
path <- Sys.getenv("R_LIBS_USER")

# # use tar on path instead
# Sys.setenv(R_BUILD_TAR = "tar")

if (!dir.exists(path)) {
  dir.create(path, showWarnings = FALSE, recursive = TRUE)
}

for (pkg in cran_packages) {
  if (!require(pkg, character.only = TRUE)) {
    install.packages(pkg, lib = path, repos = "https://cran.rstudio.com/")
  }
}

for (pkg in github_packages) {
  remotes::install_github(pkg)
}

# make sure data folder is available
if (!dir.exists("data"))
  dir.create("data")
jolars/strong.SLOPE.simulations documentation built on Aug. 10, 2020, 8:45 a.m.