Created
August 1, 2021 02:32
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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