Skip to content

Instantly share code, notes, and snippets.

@joshz
Last active August 29, 2015 14:26
Show Gist options
  • Save joshz/39e73a2bed69cd734ed6 to your computer and use it in GitHub Desktop.
Save joshz/39e73a2bed69cd734ed6 to your computer and use it in GitHub Desktop.
R Studio snippets
snippet updr
options(repos=c(CRAN='http://cran.revolutionanalytics.com'))
update.packages(ask=F)
snippet package.installer
install.packages('devtools')
library(devtools)
install_github("ririzarr/rafalib")
essential <- c('data.table', 'dplyr', 'reshape2', 'ggplot2', 'foreach', 'tidyr', 'ggvis',
'caret', 'caretEnsemble', 'Cairo', 'lubridate', 'Hmisc')
plots <- c('Rtsne', 'GGally', 'gplots', 'ggdendro', 'amap', 'gridExtra', 'heatmap3', 'dendextend')
other <- c( 'cluster', 'fastcluster', 'formatR', 'FactoMineR', 'polycor')
if(.Platform$OS.type == 'windows') {
install.packages('doParallel')
install.packages('Cairo')
} else if(.Platform$OS.type == 'unix') {
# doMC forks process, inherits variables, not sure about others
install.packages('doMC')
# needs apt-get build-dep cairo
# and libcairo2-dev
cat('Cairo requires apt-get build-dep cairo; apt-get install libcairo2-dev')
}
# Caret may need "Imports"
install.packages(essential, dependencies = c("Depends", "Suggests"), Ncpus = 2)
#plots
install.packages(plots, dependencies = c("Depends", "Suggests", Ncpus = 2)
devtools::install_github("hrbrmstr/streamgraph")
# other
install.packages(other)
install.packages("radiant", repos = "http://vnijs.github.io/radiant_miniCRAN/")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment