Switch back to lazy loading data
Closed this issue · 2 comments
From https://r-pkgs.org/data.html
If the DESCRIPTION contains LazyData: true, then datasets will be lazily loaded. This means that they won’t occupy any memory until you use them. The following example shows memory usage before and after loading the nycflights13 package. You can see that memory usage doesn’t change significantly until you inspect the flights dataset stored inside the package.
lobstr::mem_used() #> 58.74 MB library(nycflights13) lobstr::mem_used() #> 60.68 MB invisible(flights) lobstr::mem_used() #> 101.39 MBWe recommend that you include LazyData: true in your DESCRIPTION if you are shipping .rda files below data/.
I think the package loading was taking forever previously because I hadn't compressed the data... now that we have written the data with usethis::use_data(compress = "gzip")
package load time might be ok. See also #90, #91.
- Also vignette, example, or use
this::use_data()
scripts to call data objects using namespace rather thandata(object)
.
- consider using
butcher::
to reduce package data size (i.e. of models), see https://butcher.tidymodels.org/index.html also consider reducing duplicate storage of models across multiple objects (i.e.ManyEcoEvo_*viz
andManyEcoEvo_results
).