forked from johnmyleswhite/ML_for_Hackers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package_installer.R
43 lines (34 loc) · 1.51 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
34
35
36
37
38
39
40
41
42
# File-Name: package_installer.R
# Date: 2012-02-10
# Author: Drew Conway ([email protected])
# Purpose: Install all of the packages needed for the Machine Learning for Hackers case studies
# Data Used: n/a
# Packages Used: n/a
# All source code is copyright (c) 2012, under the Simplified BSD License.
# For more information on FreeBSD see: http://www.opensource.org/licenses/bsd-license.php
# All images and materials produced by this code are licensed under the Creative Commons
# Attribution-Share Alike 3.0 United States License: http://creativecommons.org/licenses/by-sa/3.0/us/
# All rights reserved.
# Create a vector containing all of the packages that will be used in the case studies
# (in no particular order)
cran.packages <- c("ggplot2",
"glmnet",
"igraph",
"lme4",
"lubridate",
"plyr",
"RCurl",
"RJSONIO",
"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(!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 ###")