forked from STAT547-UBC-2019-20/group_01_dlin_njamshidi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.R
40 lines (33 loc) · 1.67 KB
/
install.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
# author: Diana Lin
# date: March 18, 202
# list of required packages from the README
required_packages <- c("RCurl","base64enc","bookdown","broom","corrplot","crayon","docopt","devtools","fiery","glue","grid","gridExtra","hablar","here","htmltools","knitr","mime","plotly","png","psych","rmarkdown","reqres","reshape2","routr","scales","testthat","tidyverse","tinytex","viridis", "dash")
# Boolean vector of which ones are installed,
boolean <- required_packages %in% installed.packages()
# Get indices of those that are not installed
indices <- which(boolean == FALSE)
# if uninstalled packages is not 0, install those packages
if (length(indices) != 0) {
# remove 'dash' since it needs to be installed using devtools
required_packages <- required_packages[-length(required_packages)]
# remove indices of dash
indices <- indices[!indices %in% length(required_packages)]
uninstalled <- required_packages[indices]
print("Installing the following packages:")
print(uninstalled)
install.packages(uninstalled, dependencies = TRUE, repo="http://cran.rstudio.com/")
if ("devtools" %in% installed.packages()) {
if (!all(c("dash", "dashCoreComponents","dashHtmlComponents", "dashTable") %in% installed.packages())) {
print("Installing DashR from GitHub...")
devtools::install_github('plotly/dashR', upgrade = TRUE)
}
if (!"dashDaq" %in% installed.packages()) {
print("Installing dashDaq from GitHub...")
devtools::install_github('plotly/dash-daq', upgrade = TRUE)
}
print("Checking if DashR was installed correctly...")
source(here::here("scripts","check_dash.R"))
}
} else {
print("All required packages are already installed!")
}