How to reduce the size of data in an R data package

I am developing an R data package for climate change in a region and all the data are rasters.

How can I reduce the size of the files to reduce the package installation time.

I am planning to keep the package in a GitHub repositorie, not planning to send it to Cran because the size of the files.

I use usethis::use_data() which I believe compress the files already..

Hi, you could have the rasters elsewhere and only download them as needed. e.g. the files being stored elsewhere here Introduction — R Spatial

Some solutions are presented in this R-hub blog post including solutions to store data outside of your package as suggested by @williaml: How to distribute data with your R package - R-hub blog

1 Like

Thank you @williaml and @maelle for your suggestions.

Sorry for my basic comments and questions but I am not a programmer.

Some of the solutions it mean that I don't need to develop a package at all?

I am developing some R data packages for Costa Rica and Central America with data from different sources. My idea was to put data in R data packages so data could ready to use in a workflow, for example, for species distribución modeling or climate change impact, in conjunction with other packages that have the functions to do the analysis. May be this is not the way to go.

1 Like

This topic was automatically closed after 45 days. New replies are no longer allowed.


If you have a query related to it or one of the replies, start a new topic and refer back with a link.