-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.R
38 lines (29 loc) · 937 Bytes
/
setup.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
# A polite helper for installing packages ---------------------------------
please_install <- function(pkgs, install_fun = install.packages) {
if (length(pkgs) == 0) {
return(invisible())
}
if (!interactive()) {
stop("Please run in interactive session", call. = FALSE)
}
title <- paste0(
"Ok to install these packges?\n",
paste("* ", pkgs, collapse = "\n")
)
ok <- menu(c("Yes", "No"), title = title) == 1
if (!ok) {
return(invisible())
}
install_fun(pkgs)
}
# Do you have all the needed packages? ------------------------------------
tidytools <- c(
"devtools", "testthat", "covr",
"roxygen2", "lobstr", "vctrs", "sloop",
"purrr", "stringr", "ggplot2", "dplyr",
"tidyverse", "repurrrsive", "rmarkdown", "nycflights13",
"BiocManager", "BiocCheck", "available", "usethis"
)
have <- rownames(installed.packages())
needed <- setdiff(tidytools, have)
please_install(needed)