2019-01-05 09:50:22 +01:00
|
|
|
# ==================================================================== #
|
|
|
|
# TITLE #
|
|
|
|
# Antimicrobial Resistance (AMR) Analysis #
|
|
|
|
# #
|
2019-01-05 21:40:04 +01:00
|
|
|
# SOURCE #
|
|
|
|
# https://gitlab.com/msberends/AMR #
|
2019-01-05 09:50:22 +01:00
|
|
|
# #
|
|
|
|
# LICENCE #
|
2019-01-05 21:40:04 +01:00
|
|
|
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
|
2019-01-05 09:50:22 +01:00
|
|
|
# #
|
2019-01-05 21:40:04 +01:00
|
|
|
# This R package is free software; you can freely use and distribute #
|
|
|
|
# it for both personal and commercial purposes under the terms of the #
|
|
|
|
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
|
|
|
|
# the Free Software Foundation. #
|
|
|
|
# #
|
|
|
|
# This R package was created for academic research and was publicly #
|
|
|
|
# released in the hope that it will be useful, but it comes WITHOUT #
|
|
|
|
# ANY WARRANTY OR LIABILITY. #
|
2019-04-05 18:47:39 +02:00
|
|
|
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
|
2019-01-05 09:50:22 +01:00
|
|
|
# ==================================================================== #
|
|
|
|
|
|
|
|
install_if_needed <- function(pkg, repos, quiet) {
|
|
|
|
package_path <- find.package(pkg, quiet = quiet)
|
|
|
|
if (length(package_path) == 0) {
|
|
|
|
message("NOTE: pkg ", pkg, " missing, installing...")
|
2019-11-03 22:24:42 +01:00
|
|
|
if (pkg == "cleaner") {
|
|
|
|
devtools::install_github("msberends/cleaner")
|
|
|
|
} else {
|
|
|
|
install.packages(pkg, repos = repos, quiet = quiet)
|
|
|
|
}
|
2019-01-05 09:50:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gl_update_pkg_all <- function(repos = "https://cran.rstudio.com",
|
|
|
|
quiet = TRUE,
|
2019-10-11 17:21:02 +02:00
|
|
|
install_pkgdown = FALSE,
|
|
|
|
install_lintr = FALSE) {
|
2019-01-05 09:50:22 +01:00
|
|
|
# update existing
|
|
|
|
update.packages(ask = FALSE, repos = repos, quiet = quiet)
|
|
|
|
|
|
|
|
install_if_needed(pkg = "devtools", repos = repos, quiet = quiet)
|
2019-01-05 09:55:37 +01:00
|
|
|
if (install_pkgdown == TRUE) {
|
2019-01-05 09:50:22 +01:00
|
|
|
install_if_needed(pkg = "pkgdown", repos = repos, quiet = quiet)
|
|
|
|
}
|
2019-10-11 17:21:02 +02:00
|
|
|
if (install_lintr == TRUE) {
|
|
|
|
install_if_needed(pkg = "lintr", repos = repos, quiet = quiet)
|
|
|
|
}
|
2019-11-03 22:24:42 +01:00
|
|
|
install_if_needed(pkg = "cleaner", repos = repos, quiet = quiet)
|
2019-10-11 17:21:02 +02:00
|
|
|
|
2019-01-05 09:50:22 +01:00
|
|
|
devtools::install_dev_deps(repos = repos, quiet = quiet, upgrade = TRUE)
|
|
|
|
|
2019-01-05 20:39:20 +01:00
|
|
|
cat("INSTALLED:\n")
|
2019-01-05 09:50:22 +01:00
|
|
|
instld <- as.data.frame(installed.packages())
|
|
|
|
rownames(instld) <- NULL
|
|
|
|
print(instld[, c("Package", "Version")])
|
|
|
|
|
|
|
|
return(invisible(TRUE))
|
|
|
|
}
|