How to load package shiny from differtent location?

Hi, I am making a shiny app.

I want to install the package "shiny" in another folder. For example in folder "C:/Documents/R_Libraries".
Then I want to load "shiny" from that location.

I set the location with .libPaths(). I installed the shiny package. A subfolder shows up like this filepath: "C:/Documents/R_Libraries/shiny".

I try to load the shiny package with another script in a new and clear environment. But then it keeps asking me if I want to download "shiny". How is that possible? Here some code.

File 1:


File 2:

library("shiny",lib.loc = .libPaths()[1])

With other packages I do not have this problem.
I hope the solution is simple and thank you very much for helping me!

PS. the second script is run by another user. I am working on premises.

.libPaths() scope is your current R session, the change does not persist for subsequent sessions.

You can change the default library folder by setting your R_LIBS_SITE environmental variable in a .Reviron or .Rprofile file. For example:

# In a .Renviron file you can set it by adding a line like this one with the desired location 
R_LIBS_SITE="C:\\Program Files\\R\\R-4.1.2\\library"

For a more detailed explanation, you can read this blog post

1 Like

Thank you very much! This helped a lot. And thank you for the manual. I am going to read more of those manuals/blogs.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.