forked from neelsoumya/rlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathINSTALL_MANY_MODULES.R
131 lines (123 loc) · 3.28 KB
/
INSTALL_MANY_MODULES.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# source("http://egret.psychol.cam.ac.uk/rlib/INSTALL_MANY_MODULES.R")
# Also, in Ubuntu: need modules listed in R_EXTRAS variable at http://egret.psychol.cam.ac.uk/techniques/scripts/rnc_ubuntu_setup
PREFERRED_CRAN_REPOSITORY = c(CRAN="http://cran.ma.imperial.ac.uk")
install_if_absent <- function(
libname,
repos=PREFERRED_CRAN_REPOSITORY,
type=getOption("pkgType")
) {
if (require(libname, character.only=TRUE)) {
cat("Loaded library:", libname, "\n")
} else {
cat("Attempting to install package: ", libname, " (type=", type, ")\n", sep="")
install.packages(libname, repos=repos, dependencies=TRUE, type=type)
if (require(libname, character.only = TRUE)) {
cat("Loaded newly installed library:", libname, "\n")
} else {
cat("FAILED TO INSTALL PACKAGE:", libname, "\n")
}
}
}
DESIRED_LIBRARIES = c(
"arm",
"afex",
"arrayhelpers",
# "base64",
# "BMS",
"bridgesampling",
"broom",
"Cairo",
"car",
"coda",
"data.table",
"diagram",
"DiagrammeR",
"doParallel",
"doSNOW",
# WHEN RCPP VERSION CATCHES UP # "dplyr", # Oct 2014
# "extrafont", # use Cairo instead
"ez",
"foreign",
"gdata",
"ggplot2",
"gplots",
"grid",
"gridExtra",
"gtools",
"Hmisc",
"inline", # for RStan
"Kmisc", # including cat.cb, to write to the clipboard
"languageR", # removed from CRAN in 2013; then back 2013-12-12 (needs R 3.0.2) see http://cran.r-project.org/web/packages/languageR/index.html
"lattice",
"lme4",
"LMERConvenienceFunctions",
"lmerTest",
"lsmeans",
"ltm",
"lubridate",
"maptools",
"matrixStats",
"MCMCglmm",
"nlme",
"nortest",
"parallel",
"plyr",
"plotrix",
"popbio",
"proto",
# "R2jags",
# "Rcmdr", # use RStudio instead,
"Rcpp", # for RStan
"raster",
"readODS",
"readr",
"readxl",
"reshape",
"reshape2",
"rgeos",
"rgdal",
# "rjags", # also needs some command-line prerequisites
"rstan", # if fails: install.packages("rstan", repos = "https://cloud.r-project.org/", dependencies=TRUE)
# ... see https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started
"RMySQL",
"RODBC",
"semver",
"shinystan",
"snow",
"sp", # spatial, for maps
"sqldf",
"stringr",
"TTR",
"visreg",
"XLConnect",
"xlsx",
"xtermStyle",
"zoo",
"pheatmap",
"glmnet",
"randomForest",
"bookdown",
"caret"
)
# First, update packages:
update.packages(checkBuilt=TRUE, ask=FALSE)
# Now install:
for (libname in DESIRED_LIBRARIES) {
install_if_absent(libname)
}
# rstan used to require special procedures, but doesn't any more:
# https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started
#cat("
#
#===============================================================================
#DONE MAJOR PACKAGES. Now trying RStan...
#===============================================================================
#")
#
## RStan is a package that's a bit different:
#install_if_absent(
# "rstan",
# repos="https://github.com/stan-dev/rstan",
# type="source")
## ... formerly (1) http://wiki.stan.googlecode.com/git/R
## ... formerly (2) http://wiki.rstan-repo.googlecode.com/git/