Last active
August 29, 2015 14:02
-
-
Save dceoy/c472e300cd0423023869 to your computer and use it in GitHub Desktop.
[R] Load packages
This file contains 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/env Rscript | |
load_pkgs <- function(pkgs, repos = 'http://cran.rstudio.com/') { | |
update.packages(checkBuilt = TRUE, ask = FALSE, repos = repos) | |
sapply(pkgs, | |
function(p) { | |
if (! p %in% installed.packages()[,1]) install.packages(p, dependencies = TRUE, repos = repos) | |
require(p, character.only = TRUE) | |
}) | |
} | |
# example | |
load_pkgs(pkgs = c('dplyr', | |
'data.table', | |
'RSQLite', | |
'foreach', | |
'doSNOW', | |
'ggplot2')) |
This file contains 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
source('http://bioconductor.org/biocLite.R') | |
biocLite() |
This file contains 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
# export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib/ | |
install.packages('Rmpi', | |
configure.args = c('--with-Rmpi-include=/usr/include/openmpi-x86_64/', # where mpi.h is located | |
'--with-Rmpi-libpath=/usr/lib64/openmpi/lib/', # where libmpi.so is located | |
'--with-Rmpi-type=OPENMPI')) |
This file contains 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
Sys.setenv(MAKEFLAGS = '-j4') | |
source('http://mc-stan.org/rstan/install.R', echo = TRUE, max.deparse.length = 2000) | |
install_rstan() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment