Skip to content

Instantly share code, notes, and snippets.

@remlapmot
Last active April 5, 2024 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remlapmot/fb3f92654873d658949eb29c070d5716 to your computer and use it in GitHub Desktop.
Save remlapmot/fb3f92654873d658949eb29c070d5716 to your computer and use it in GitHub Desktop.
# 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