How to change the storage directory of the downloaded binary packages when installing

As title. Generally, when we install the packages, the downloaded binary package will be stored in the "C:\Users\Administrator\AppData\Local\Temp\RtmpkfBCB1\downloaded_packages" directory, but the C disk will take a heavy burden if we install more packages. I am grateful anyone can give a solution to change the storage directory, for example, D, or E, or F disk. Thanks a lot!

Have you noticed that it is a temp directory? You don't need to keep the content you can manually delete it or use the "disk cleanup" tool on windows.

Hi Andrescs,

Thanks! Yes, I know it is temp folder, Anyway, if every time I delete packages manually, I think it is cumbersome. I would like to change the folder, and if possible, transfer it into D,E,or F disk. and it may be fast and easy to delete manually. Do you agree?

From the documentation of install.packages()

destdir

directory where downloaded packages are stored. If it is NULL (the default) a subdirectory downloaded_packages of the session temporary directory will be used (and the files will be deleted at the end of the session).

It says the files will be deleted at the end of the R session, but you can specify the folder using that parameter if you want.

This shouldn't be something to worry about, if you had so little space in your disk for this to be a problem you wouldn't be able to make any practical use of R either.

2 Likes

Thanks for your kindness.

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.