-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_deps.R
64 lines (54 loc) · 1.6 KB
/
install_deps.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
# This script installs some development packages that are needed for various
# apps. It can be sourced from RStudio, or run with Rscript.
# Returns the file currently being sourced or run with Rscript
this_file <- function() {
cmdArgs <- commandArgs(trailingOnly = FALSE)
needle <- "--file="
match <- grep(needle, cmdArgs)
if (length(match) > 0) {
# Rscript
return(normalizePath(sub(needle, "", cmdArgs[match])))
} else {
# 'source'd via R console
return(normalizePath(sys.frames()[[1]]$ofile))
}
}
is_installed <- function (pkg) {
if (system.file(package = pkg) == "")
FALSE
else
TRUE
}
# Install a package or packages if not already installed.
install_if_needed <- function(pkgs) {
installed_idx <- vapply(pkgs, is_installed, TRUE)
needed <- pkgs[!installed_idx]
if (length(needed) > 0) {
message("Installing needed packages from CRAN: ", paste(needed, collapse = ", "))
install.packages(needed)
}
}
# Core packages
install_if_needed(c("devtools",
"rintrojs",
"shinydashboard",
"shinyBS",
"interviewer",
"dplyr",
"stringr",
"png",
"shinyjs",
"DT",
"visNetwork",
"rintrojs",
"readxl",
"tidyverse",
"scales",
"Rtools"
))
# Some packages must be installed from GitHub
devtools::install_github(c(
# For 087-crandash
"mtrybulec/interviewer"
# , "rstudio/shiny"
))