[Rd] Recommended change to CheckLazyDataCompression section in WRE

Hugh Parsonage hugh@p@r@on@ge @end|ng |rom gm@||@com
Wed Jul 13 01:19:22 CEST 2022


Thank you for the helpful function in WRE. I recommend the following
changes to avoid inadvertent errors

CheckLazyDataCompression <- function(pkg)
{
    pkg_name <- sub("_.*", "", basename(pkg))   # in case pkg is in a
different directory
    lib <- tempfile(); dir.create(lib)
    zs <- c("gzip", "bzip2", "xz")
    res <- double(3); names(res) <- zs   # is a double vector
    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")  # otherwise an error on Windows
        res[z] <- file.size(file.path(lib, pkg_name, "data", "Rdata.rdb"))
    }
    ceiling(res/1024)
}

Relatedly, the footnote (currently 24) says:
> For all the CRAN packages tested, either gz or bzip2 provided a very substantial reduction in installed size.

I believe this should be "xz or bzip2"

Finally, I also note the sentence in the same section

"Lazy-loading is not supported for very large datasets (those which
when serialized exceed 2GB, the limit for the format on 32-bit
platforms)"

Is this still applicable?

Best,

Hugh.



More information about the R-devel mailing list