Packages getting installed in temp folder (Beginner here, Please help)

Package problem, can I change the directory of the installation of the packages? Packages like "dplyr" installing again and again while execution.

R_code <- > install.packages("devtools")
Installing package into ‘C:/Users/user/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
also installing the dependencies ‘ini’, ‘clisymbols’, ‘gh’, ‘rprojroot’, ‘rex’, ‘xopen’, ‘brew’, ‘commonmark’, ‘praise’, ‘usethis’, ‘covr’, ‘desc’, ‘DT’, ‘git2r’, ‘memoise’, ‘pkgbuild’, ‘pkgload’, ‘rcmdcheck’, ‘roxygen2’, ‘rversions’, ‘sessioninfo’, ‘testthat’

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/ini_0.3.1.zip'
Content type 'application/zip' length 15636 bytes (15 KB)
downloaded 15 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/clisymbols_1.2.0.zip'
Content type 'application/zip' length 21116 bytes (20 KB)
downloaded 20 KB

Didn't add other links because of the limit

package ‘ini’ successfully unpacked and MD5 sums checked
package ‘clisymbols’ successfully unpacked and MD5 sums checked
package ‘gh’ successfully unpacked and MD5 sums checked
package ‘rprojroot’ successfully unpacked and MD5 sums checked
package ‘rex’ successfully unpacked and MD5 sums checked
package ‘xopen’ successfully unpacked and MD5 sums checked
package ‘brew’ successfully unpacked and MD5 sums checked
package ‘commonmark’ successfully unpacked and MD5 sums checked
package ‘praise’ successfully unpacked and MD5 sums checked
package ‘usethis’ successfully unpacked and MD5 sums checked
package ‘covr’ successfully unpacked and MD5 sums checked
package ‘desc’ successfully unpacked and MD5 sums checked
package ‘DT’ successfully unpacked and MD5 sums checked
package ‘git2r’ successfully unpacked and MD5 sums checked
package ‘memoise’ successfully unpacked and MD5 sums checked
package ‘pkgbuild’ successfully unpacked and MD5 sums checked
package ‘pkgload’ successfully unpacked and MD5 sums checked
package ‘rcmdcheck’ successfully unpacked and MD5 sums checked
package ‘roxygen2’ successfully unpacked and MD5 sums checked
package ‘rversions’ successfully unpacked and MD5 sums checked
package ‘sessioninfo’ successfully unpacked and MD5 sums checked
package ‘testthat’ successfully unpacked and MD5 sums checked
package ‘devtools’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\user\AppData\Local\Temp\RtmpQ3PYhw\downloaded_packages

Hi,

Welcome to the RStudio community!

It's normal for the binary packages to be in a temp folder, as these installation files can be removed afterwards. The package itself is stored in your library (C:/Users/user/Documents/R/win-library/3.6).

What I think is going on is that you are not loading the library after installing it, but running the code for installation over and over again. So the first time you install a package you do this:

install.packages("tidyverse")

But once you installed it once, you load the library in your code and do not use the install.packages again

library(tidyverse)

Does this help?

PJ

2 Likes

Hey Pieter,
Thank you for the lucid description. Sorry if I was not more clear in my original post.

Let's say I did install.packages("tidyverse") (it shows red coloured console replies and saves it to temp folder)
and then load it, library(tidyverse) once in a separate xyz.r , and then in a new script, say abc.r, I directly load using library(tidyverse) it won't be an issue right? (if after a few days temp files get deleted?)

Really sorry if this is a bad question, I'm eagerly learning more and would be efficient with further posts.

Yes, you can just use the library() function in any script to load the package after the initial installation.
The packages tab of RStudio, at the lower right in the default configuration, shows all of the packages that are available and you can look there to confirm you have a package.

1 Like