Skip to content

Commit

Permalink
standardize on pak installs
Browse files Browse the repository at this point in the history
  • Loading branch information
topepo committed Feb 9, 2021
1 parent 8159c83 commit f10ecd1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 139 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,4 @@ RegressionTests/badhess.txt

pkg/caret/revdep

release_process/update_pak.Rout
55 changes: 27 additions & 28 deletions release_process/update_pak.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
options(repos = "http://cran.r-project.org")
options(repos = "http://cran.r-project.org", width = 100)
library(tools)
library(pak)
library(cli)

# ------------------------------------------------------------------------------

###################################################################
## Get the names of all CRAN related packages references by caret.
## Exclude orphaned and Bioconductor packages for now

Expand All @@ -16,32 +18,15 @@ library(caret)
mods <- getModelInfo()

libs <- unlist(lapply(mods, function(x) x$library))
libs <- unique(sort(libs))
libs <- libs[!(libs %in% c("caret", "vbmp", "gpls", "logicFS", "SDDA"))]
libs <- c(libs, "knitr", "Hmisc", "googleVis", "animation",
"desirability", "networkD3", "heatmaply", "arm", "xtable",
"RColorBrewer", "gplots", "iplots", "latticeExtra",
"scatterplot3d", "vcd", "igraph", "corrplot", "ctv",
"Cairo", "shiny", "scales", "tabplot", "tikzDevice", "odfWeave",
"multicore", "doMC", "doMPI", "doSMP", "doBy",
"foreach", "doParallel", "aod", "car", "contrast", "Design",
"faraway", "geepack", "gmodels", "lme4", "tidyr", "devtools", "testthat",
"multcomp", "multtest", "pda", "qvalue", "ChemometricsWithR", "markdown",
"rmarkdown", "pscl",
## odds and ends
"ape", "gdata", "boot", "bootstrap", "chron", "combinat", "concord", "cluster",
"desirability", "gsubfn", "gtools", "impute", "Matrix", "proxy", "plyr",
"reshape", "rJava", "SparseM", "sqldf", "XML", "lubridate", "GA",
"aroma.affymetrix", "remMap", "cghFLasso", "RCurl", "QSARdata", "reshape2",
"mapproj", "ggmap", "ggvis", "SuperLearner", "subsemble", "caretEnsemble",
"ROSE", "DMwR", "ellipse", "bookdown", "DT", "AppliedPredictiveModeling",
"pROC", "ggthemes", "sessioninfo", "mlbench", "tidyverse",
"vbmp", "gpls", "logicFS", "graph", "RBGL", "BiocManager")
libs <- c(libs, package_dependencies("caret", reverse = TRUE)$caret)
libs <- unique(libs)

# Don't install rJava in case it borks the existing system
libs <- libs[libs != "rJava"]

# ------------------------------------------------------------------------------

###################################################################
## Check to see if any packages are not on CRAN

options(repos = "http://cran.r-project.org")
Expand All @@ -50,21 +35,35 @@ all_pkg <- rownames(available.packages(type = "source"))
diffs <- libs[!(libs %in% all_pkg)]
if (length(diffs) > 0) print(diffs)

###################################################################
# ------------------------------------------------------------------------------
## Install the files. This might re-install caret so beware.

# devtools::install_github('dmlc/xgboost',subdir='R-package')

libs <- sort(libs)
n <- length(libs)
iters <- format(1:n)
libs_chr <- format(libs)

for (i in seq_along(libs)) {
cli::cli_rule(paste0(libs_chr[i], " (", iters[i], "/", n, ")"))

res <- try(
pkg_install(libs[i], upgrade = TRUE, ask = FALSE),
pak(libs[i], upgrade = TRUE, ask = FALSE),
silent = TRUE
)

print(res)
if (inherits(res, "try-error")) {
cat("Failed to install", libs[i], "\n\n")
print(as.character(res))
}

cat("\n\n")
}

# ------------------------------------------------------------------------------
# exceptions:

install.packages("CHAID", repos="http://R-Forge.R-project.org")

# ------------------------------------------------------------------------------

q("no")
111 changes: 0 additions & 111 deletions release_process/update_pkgs.R

This file was deleted.

0 comments on commit f10ecd1

Please sign in to comment.