-
-
Save sklppr/cec1b80642e02a12d4e57bc51d803c2e to your computer and use it in GitHub Desktop.
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 | |
# Install a custom R version, https://www.r-project.org/ | |
# | |
# Add at least the following environment variables to your project configuration | |
# (otherwise the defaults below will be used). | |
# * R_VERSION | |
# | |
# Include in your builds via | |
# source /dev/stdin <<< "$(curl -sSL https://gist.githubusercontent.com/sklppr/cec1b80642e02a12d4e57bc51d803c2e/raw/089ca9b56d6b2364df29db4e78039c3404ce437f/r.sh)" | |
R_VERSION=${R_VERSION:="3.3.0"} | |
R_PATH=${R_PATH:=$HOME/r} | |
CACHED_DOWNLOAD="${HOME}/cache/R-${R_VERSION}.tar.gz" | |
mkdir -p "${R_PATH}" | |
wget --continue --output-document "${CACHED_DOWNLOAD}" "https://cran.r-project.org/src/base/R-${R_VERSION%%.*}/R-${R_VERSION}.tar.gz" | |
tar -xaf "${CACHED_DOWNLOAD}" --strip-components=1 --directory "${R_PATH}" | |
( | |
cd "${R_PATH}" || exit 1 | |
./configure --enable-R-shlib | |
make | |
) | |
export PATH="${R_PATH}/bin:${PATH}" | |
# check the correct version is yused | |
R --version | grep "${R_VERSION}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment