How to effectively deal with uncompressed saves du

2019-03-09 12:52发布

问题:

In recent efforts to develop a package, I'm including datasets in the data/ folder of my package. In my specific case I have 5 datasets all of which are in data.table format (although the issues I describe below persist if I keep them as data.frame). I've saved each one as individual .rda files and documented them appropriately.

When I run check() from package devtools, I get the following warnings:

 checking data for ASCII and uncompressed saves ... WARNING
  Warning: large data file(s) saved inefficiently:
          size ASCII compress
  data1.rda 129Kb  TRUE     gzip
  data2.rda 101Kb  TRUE     gzip
  data3.rda 1.6Mb  TRUE     gzip

  Note: significantly better compression could be obtained
        by using R CMD build --resave-data
              old_size new_size compress
  data1.rda         129Kb     34Kb       xz
  data2.rda         101Kb     20Kb       xz
  data4.rda          92Kb     35Kb       xz
  data3.rda         1.6Mb    116Kb       xz
  species.rda     12Kb      9Kb       xz

I've tried saving the data with resaveRdaFiles (package tools) with the recommended xz compression. Even after doing that, the warning persists.

OK, so I run R CMD build --resave-data and the warning continues to persist.

What am I missing here and how do I overcome this issue (now and in the future)?

回答1:

When you save your .rda file, please use the command: save(..., file='test.rda', compress='xz') This will help to solve the problem!