Is it possible to create temporary files that are used for running examples?

Hi - the size of my R package exceeds 5MB, which hinders publication on CRAN. The large package size is due to the example data required to run the examples. The reason why the example data is so large is because I have many functions that produce output files that form inputs to other functions. I could reduce my package size if I could create the following workflow:

example data 1 -> function 1 -> output 1 -> function 2 -> output 2 -> function 3 -> output 3 -> etc.

However, CRAN does not permit that functions produce output files by default. My current set up is, therefore:

example data 1 -> function 1
example data 2 -> function 2
example data 3 -> function 3

This works fine, but given that I need to provide example data 1, 2, 3, the package becomes too large.
Question: Is there a way that I may write temporary files that can be used by other functions and that are deleted afterwords? This way I could still use the first rather than the second workflow. Thank you very much for your advice.

Cheers, Christian

Just thinking can you make make couple of packages based on the topic :slight_smile: just thinking

Hi - thank you for your thoughts. No, those functions work in concert and should be part of the same package.

R base provides functions tempdir() (and tempfile()), I've used this for temporary outputs in my own work, but not a package context, so not sure about your particular issues with package creation.

Thank you - I will give that a try.

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.