Skip to content

Instantly share code, notes, and snippets.

@sellorm
Created October 20, 2017 19:50
Show Gist options
  • Save sellorm/ee81d4ad42831f0fc6951c987fe2bb37 to your computer and use it in GitHub Desktop.
Save sellorm/ee81d4ad42831f0fc6951c987fe2bb37 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
pkg=${1}
function help {
echo "Usage: $(basename $0) <package name>"
exit 1
}
[ -z ${pkg} ] && help
REXEC=$(which R)
if [ -z ${REXEC} ]; then
echo "R not found, please ensure R is available and try again."
exit 1
fi
echo "install.packages(\"${pkg}\", repos=\"https://cran.rstudio.com\")" | R --no-save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment