Unable to intall packages

I have tried to install packages but I get the notification saying 'Unable to install packages because the default library (file location path in my c drive is written here) is not writeable.
How can I solve this.

Thank you

It is hard to tell, since your not providing the actual console output of the error message. But, in general terms, you could run R (or RStudio if you are using it) as "Administrator" or, you could set your default package library to a folder where you have write permissions.

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

This topic was automatically closed 21 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.