Skip to content

Instantly share code, notes, and snippets.

@benfasoli
Last active October 21, 2019 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benfasoli/268c55ba75f33a997c58f8fcc46dd3af to your computer and use it in GitHub Desktop.
Save benfasoli/268c55ba75f33a997c58f8fcc46dd3af to your computer and use it in GitHub Desktop.
Configure R for user-scoped package management
#!/bin/bash
# wget https://gist.github.com/benfasoli/268c55ba75f33a997c58f8fcc46dd3af/raw/ -O - | bash
mkdir -p $HOME/.Rpackages && \
echo "system('source $HOME/.bashrc')
.libPaths(
c(
'$HOME/.Rpackages',
.libPaths()
)
)
local({
repo <- getOption('repos')
repo['CRAN'] <- 'https://cloud.r-project.org/'
options(repos = repo)
})" > $HOME/.Rprofile
echo "
R_USER=$(whoami)
R_LIBS=$HOME/.Rpackages
" > $HOME/.Renviron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment