Last active
April 5, 2024 10:25
-
-
Save remlapmot/fb3f92654873d658949eb29c070d5716 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Amendment from https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Data-in-packages | |
# https://stat.ethz.ch/pipermail/r-devel/2022-July/081873.html | |
CheckLazyDataCompression <- function(pkg) | |
{ | |
pkg_name <- sub("_.*", "", pkg) | |
lib <- tempfile(); dir.create(lib) | |
zs <- c("gzip", "bzip2", "xz") | |
res <- double(3); names(res) <- zs | |
for (z in zs) { | |
opts <- c(paste0("--data-compress=", z), | |
"--no-libs", "--no-help", "--no-demo", "--no-exec", "--no-test-load") | |
install.packages(pkg, lib, INSTALL_opts = opts, repos = NULL, quiet = TRUE, type = "source") | |
res[z] <- file.size(file.path(lib, pkg_name, "data", "Rdata.rdb")) | |
} | |
ceiling(res/1024) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment