[R-pkg-devel] Removing packages files

Lluís Revilla ||u|@@rev|||@ @end|ng |rom gm@||@com
Thu Jan 2 15:55:39 CET 2025


Hi list,

I am developing a package that will download some data, and I'd like
to store it locally to not recalculate it often.
The CRAN policy requires tools::R_user_dir to be used and "the
contents are actively managed (including removing outdated material)"
or using TMPDIR but "such usage should be cleaned up".

When loading a package there is .onLoad or .onAttach to fill or check
those files and other settings required for a package. Is there
something for when a package is removed?

I found some related functions like .Last or reg.fnalizer and setHook
or packageEvent but they are about closing a session or don't have a
specific event for when uninstalling packages via (remove.packages). I
appreciate any feedback, thanks in advance.

Best wishes and a happy new year,

Lluís



More information about the R-package-devel mailing list