Reducing size of R package to under 5 Mb

I am trying to submit an update of one of my R packages.

The latest update contains a Shiny app which takes up 5.4 Mb of 5.7 Mb for the total package.

CRAN rules stipulate that packages must not be more than 5 Mb in size.

I've removed all that I can from the app without compromise, but am still facing an excess of 0.4 Mb over the allowable package size limit.

Are there any specific workarounds I can implement to solve my issue so that the package may be published?

I suppose I could ask for an exemption, but there's no guarantee it will be granted.

Is it 5.4 MB of pure code? i.e. 5 million characters, ~ 100,000 lines of code? Or is there a dataset or images included?

In the first case (that's a huge app) I would suggest putting some of the code in a separate package: one package for the low-level operations, one for the Shiny app which imports the first.

In the second, well depends how critical they are. Increasing compression levels can save a few %, but at the price of longer decompression times, decreasing image quality can sometimes save a lot with minimal visual difference. For datasets, it can make sense to store it in a separate package (CRAN should accept if you're not going to update it frequently), or to download it as needed...

Thanks @AlexisW .

For me, it's the second case. I have 6 FASTA files in a www folder causing the issue. The other content of this folder comprises images.

I wonder if I can zip the FASTA files and then call utils::unzip() to decompress them.

Yes, FASTA should be very efficiently compressed (since you have few possible characters, it contains a lot less information than the same size in text). You can probably get at least 50% compression rate, or even more; that should be more than enough in your case.

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.