Last active
April 8, 2016 15:35
-
-
Save pjbriggs/4adcfe25ebb351a1ed29 to your computer and use it in GitHub Desktop.
Script to install local versions of R libraries needed by CRAFT-GP pipeline
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
#!/usr/bin/bash | |
# | |
packages="dplyr coloc readr tidyr stringr optparse" | |
export INSTALL_DIR=$(pwd)/R_LIBS/CRAFT-GP | |
if [ ! -d $INSTALL_DIR ] ; then | |
mkdir -p $INSTALL_DIR | |
fi | |
export R_LIBS=$R_LIBS:$INSTALL_DIR | |
for package in $packages ; do | |
package_info=$(echo 'installed.packages()[,c("Package","Version")]' | R --vanilla | grep ^$package) | |
echo $package: $package_info | |
if [ ! -z "$package_info" ] ; then | |
echo "FOUND $package: $package_info" | |
else | |
R --vanilla <<EOF | |
install.packages("$package",lib="$INSTALL_DIR",repos="http://cran.ma.imperial.ac.uk/") | |
q() | |
EOF | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After running the script you'll need to add the dependencies to the
R_LIBS
environment variable e.g.