-
Notifications
You must be signed in to change notification settings - Fork 0
/
package_installer.R
33 lines (29 loc) · 1.01 KB
/
package_installer.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
# setup the installation repository
options(repos=structure(c(CRAN="https://cloud.r-project.org/")))
# List out the packages in a vector
cran.packages <- c("e1071",
"ggplot2",
"glmnet",
"Hmisc",
"igraph",
"lme4",
"lubridate",
"plyr",
"RCurl",
"reshape",
"RJSONIO",
"scales",
"tm",
"XML")
cat("This script will now attempt to install all of the R packages used in 'Machine Learning for Hackers'")
for(p in cran.packages) {
# if package is not available, install it
if(!suppressWarnings(require(p, character.only = TRUE, quietly = TRUE))) {
cat(paste(p, "missing, will attempt to install\n"))
install.packages(p, dependencies = TRUE, type = "source")
}
else {
cat(paste(p, "installed OK\n"))
}
}
print("### All required packages installed ###")