Skip to content

Instantly share code, notes, and snippets.

@MichaelChirico
Last active May 10, 2026 20:50
Show Gist options
  • Select an option

  • Save MichaelChirico/11b1a273dbf14ba44739aa52f60cd4da to your computer and use it in GitHub Desktop.

Select an option

Save MichaelChirico/11b1a273dbf14ba44739aa52f60cd4da to your computer and use it in GitHub Desktop.
Search CRAN packages for senstivity to wilcox.test(digits.rank=X)
# Assume these are installed in a state to pass R CMD check, i.e.,
# with enough Suggests to pass with _R_CHECK_FORCE_SUGGESTS_=false
packages <- c("cardx", "caTools", "clintools", "cogmapr", "CRMetrics", "EasyDescribe",
"effectsize", "EnvStats", "eyetrackingR", "ggpubr", "ggpval", "ggsignif",
"gtsummary", "iCellR", "iDOS", "jsmodule", "LGDtoolkit", "microeco",
"mnda", "mt", "PairedData", "pairwiseCI", "papeR", "pctax", "pcutils",
"PLEXI", "plotbb", "plotthis", "PopComm", "qPCRtools", "RadOnc",
"rattle", "rbiom", "Rcmdr", "RcmdrPlugin.MPAStats", "rcompanion",
"rempsyc", "ReporterScore", "SCpubr", "sigminer", "tinyarray",
"TOSTER", "UCSCXenaShiny", "voiceR", "volcano3D")
R_BIN <- "~/svn/r-devel/bin/R"
check_package <- function(pkg, digits_rank) {
if (!dir.exists(pkg)) {
system(sprintf("git clone --depth 1 https://github.com/cran/%s.git", pkg),
ignore.stdout=TRUE, ignore.stderr=TRUE)
}
if (!dir.exists(pkg)) return(FALSE)
# 'xvfb-run -a' doesn't work in parallel
display_num <- 100 + (Sys.getpid() %% 50000)
# Inject the rank environment variable and wrap with xvfb-run for graphical/X11 plotting tests
env <- paste0("WILCOX_DIGITS_RANK=", digits_rank, " _R_CHECK_FORCE_SUGGESTS_=false")
cmd <- sprintf("env %s xvfb-run -n %d %s CMD check %s", env, display_num, R_BIN, pkg)
ret <- system(cmd, ignore.stdout=TRUE, ignore.stderr=TRUE)
return(ret == 0)
}
eval_pkg <- function(pkg) {
cat(sprintf("[%s] Starting evaluation\n", pkg))
if (!check_package(pkg, "Inf")) {
cat(sprintf("[%s] FAILED at baseline (Inf).\n", pkg))
return(data.frame(package = pkg, minimum_valid_digits_rank = "Fails at Inf"))
}
low <- 1
high <- 7
min_pass <- NA
while (low <= high) {
mid <- floor((low + high) / 2)
if (check_package(pkg, as.character(mid))) {
min_pass <- mid
high <- mid - 1
} else {
low <- mid + 1
}
}
min_pass_str <- ifelse(is.na(min_pass), "Inf", as.character(min_pass))
cat(sprintf("[%s] Finished. Min pass: %s\n", pkg, min_pass_str))
return(data.frame(package = pkg, minimum_valid_digits_rank = min_pass_str))
}
library(parallel)
results_list <- mclapply(packages, eval_pkg, mc.cores = 4L, mc.preschedule = FALSE)
results <- do.call(rbind, results_list)
print(results)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment