Skip to content

Instantly share code, notes, and snippets.

@javieroot
Forked from dmarcelinobr/Install_R.R
Created November 25, 2017 19:54
Show Gist options
  • Save javieroot/8abed5d38fe0aa3819e407ddd6e25fbd to your computer and use it in GitHub Desktop.
Save javieroot/8abed5d38fe0aa3819e407ddd6e25fbd to your computer and use it in GitHub Desktop.
R script and instructions to install commonly used R packages and instructions for using OpenBLAS on OS X via Homebrew Raw
##############################################################################
# title : InstallPackages.R;
# purpose : install R packages commonly used by Adam H.Sparks when upgrading or installing R;
# producer : prepared by A. H. Sparks;
# last update : in Los Baños, Laguna, PHL, May 2015;
# inputs : none;
# outputs : none;
# remarks 1 : in order to download any packages, you need to be on-line, of course;
# remarks 2 : for country outlines and the like see http://www.gadm.org/ to download Rdata packages;
##############################################################################
setRepositories() #select amongst repositories that the R installation is aware of OMEGAHAT is necessary for RKML, etc.
install.packages("ctv", dep = TRUE) #CRAN Task Views
library(ctv) #load ctv library
install.views("Spatial") #spatial analysis
install.packages("gpclib", dep = TRUE)
install.views("Graphics") #Graphic Displays & Dynamic Graphics & Graphic Devices & Visualization
install.views("Environmetrics") #analyse ecological and environmental data
#packages necessary for work that are not included in the CTV
install.packages("doMC", dep = TRUE) #multicore support
install.packages("debug", dep = TRUE) #debug package for step through of functions
install.packages("RCurl", dep = TRUE) #RCurl for fetching data remotely
install.packages("R2HTML", dep = TRUE)
install.packages("RKML", dep = TRUE) #high-level facilities to generate KML for display in Googleearth
install.packages("RKMLDevice", dep = TRUE)
install.packages("RODBC", dep = TRUE)
install.packages("dismo", dep = TRUE)
install.packages("tableplot", dep = TRUE)
install.packages("doBy", dep = TRUE)
install.packages("lubridate", dep = TRUE)
install.packages("sqldf", dep = TRUE)
#cropsim packages
install.packages("cropsim") #Enable R-forge repository first
#packages for big dataset handling
install.packages("data.table", dep = TRUE)
install.packages("biglm", dep = TRUE)
install.packages("biganalytics", dep = TRUE)
install.packages("biglars", dep = TRUE)
install.packages("speedglm", dep = TRUE)
#use ttf and other fonts in graphs
install.packages("extrafont", dep = TRUE)
library(extrafont)
font_import()
loadfonts()
#tools for tidying model outputs
install.packages("broom", dep = TRUE)
#tools for visulazation
devtools::install_github("daattali/ggExtra")
install.packages("gridExtra")
# Tools for network analysis
source("http://bioconductor.org/biocLite.R")
biocLite("impute")
install.packages("WGCNA")
# Color palletes
install.packages("wesanderson", dep = TRUE)
# In order to change which BLAS is used, change the libRblas.dylib symlink
# Option 1 for using openBLAS
cd /Library/Frameworks/R.framework/Resources/lib
sudo rm libRblas.dylib
brew tap homebrew/science
brew install openblas
ln -sf /usr/local/Cellar/openblas/0.2.14_1/lib/libopenblas.dylib /Library/Frameworks/R.framework/Resources/lib/libRblas.dylib
#Option 2 - install r with openblas through homebrew
brew tap homebrew/dupes
brew install tcl-tk --with-tk
ln -s /usr/local/Cellar/tcl-tk/8.6.1/lib/libtcl8.6.dylib /usr/local/lib/libtcl8.6.dylib
ln -s /usr/local/Cellar/tcl-tk/8.6.1/lib/libtk8.6.dylib /usr/local/lib/libtk8.6.dylib
brew tap homebrew/science
brew install r --with-openblas
#eos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment