Is there a way to uninstall package in both project library and cache?

35 Views Asked by At

Suppose I create a new project with renv activated. Then I install a package by install.packages('tictoc')

After a while, I don't need it any more, so I remove it from my project library by renv::remove('tictoc')

It indeed disappeared in the folder renv::paths$library(). However it is still in the cached library(which by definition shared by all projects managed by renv) in renv::paths$cache().

So if I want to also remove it from the cache,is there a command to do so? Or I could only remove it manually?

For just one package, that was fine, but if the package was installed with 10+ dependencies and I want to remove them from project library and meanwhile remove them from cache, what should I do?

And if the cache's package is pointed by more than one project's library, then I shouldn't remove the package in cache; since even project A won't need it but project B may need it. If there is a method to do this, I want it to alerm me that.

1

There are 1 best solutions below

0
cloudscomputes On

I think I found the answer

We can use renv::purge() to remove package from cache.

I don't think it will warn you if there is some project library's package linked to it. So need to be very careful.