How to compress save in assembly R

I am trying to include a (somewhat) large dataset in an R package. I keep getting a warning during validation in Rstudio saying that I could save some space with compression:

* checking data for ASCII and uncompressed saves ... WARNING Note: significantly better compression could be obtained by using R CMD build --resave-data old_size new_size compress slp.rda 499Kb 310Kb bzip2 sst.rda 1.3Mb 977Kb xz 

I tried adding -- resave-data to RStudio "Configure Buid Tools" without any consequences.

enter image description here

+6
source share
2 answers

The devtools use_data function accepts a parameter for the compression type and makes it easy to add data to pkgs in general. Using it or just save yourself), use xz compression when saving your data (for save this is the compression_level parameter).

If you want to use --resave-data , you can try --resave-data=best , since only with --resave-data gzip used by default (in this case you get almost nothing).

See Creating archive cards for more information .

+5
source

Another alternative, if you have a large dataset that you donโ€™t want to recreate, is to use tools::resaveRdaFiles from inside R. Put it in the dataset file or the entire data directory and it will compress your data in the format you choose. See his man page for more information.

0
source

All Articles