Skip to content

Instantly share code, notes, and snippets.

@RyanGreenup
Created August 1, 2021 02:32
Show Gist options
  • Save RyanGreenup/9feecbce69a7a3d3f0bd7e39703ced79 to your computer and use it in GitHub Desktop.
Save RyanGreenup/9feecbce69a7a3d3f0bd7e39703ced79 to your computer and use it in GitHub Desktop.
Set the mirror for R so it doesn't ask when installing packages, use stow to manage symlinks.
#!/bin/bash
IFS="\n"
# Set Directories ............................................
DotFiles="~/DotFiles/"
R_DotFiles="${DotFiles}R/"
# Main Function.............................................
main() {
## Make the directory
mkdir -p "${R_DotFiles}"
## Copy the config
echo "${SetCranMirror}" > ~/DotFiles/R/.Rprofile
## Use stow to do manage the symlinks
cd "${DotFiles}"
stow -S R -t "${HOME}" -d "${DotFiles}"
}
# Config String ............................................
SetCranMirror="
## Set CRAN Mirror:
local({
r <- getOption("repos")
r["CRAN"] <- "https://cloud.r-project.org/"
options(repos = r)
})
"
# Do it ....................................................
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment