Re: [R-pkg-devel] Removing packages files

2025-01-02 Thread Henrik Bengtsson
As a first step, this sounds like something for the 'tools' package, e.g. tools::cleanup_R_user_dir() that wipes package subfolders of packages no longer installed, or the specified package, iff given. With that in place, one could argue for adding a 'cleanup' argument to remove.packages() that use

Re: [R-pkg-devel] Removing packages files

2025-01-02 Thread Duncan Murdoch
Sorry, I misunderstood what you are after. I thought you only wanted to keep it for the duration of a session. I don't think there's a way to keep a file beyond the current session, but uninstall it later when the package is uninstalled. I think the way you should handle this is to offer a f

Re: [R-pkg-devel] Removing packages files

2025-01-02 Thread Lluís Revilla
Dear Duncan, Thank you for your answer. I checked again and made a mock package that removes a file with .onDetach. The file was not removed upon uninstalling the package. Lluís On Thu, 2 Jan 2025 at 17:23, Duncan Murdoch wrote: > > On 2025-01-02 9:55 a.m., Lluís Revilla wrote: > > Hi list, > >

Re: [R-pkg-devel] Removing packages files

2025-01-02 Thread Duncan Murdoch
On 2025-01-02 9:55 a.m., Lluís Revilla wrote: 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 m

[R-pkg-devel] Removing packages files

2025-01-02 Thread Lluís Revilla
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