Unable to install ggplot2
15,853
Solution 1
It would actually suffice to invoke as follows:
> install.packages('ggplot2', dep=TRUE, lib=NULL)
and R should substitue lib
with the default location, as in my comment.
Or you could change the environment variable itself.
Solution 2
R needs to have write access to your library to install a package there. The other advice you're getting is good and should be preferred, but you can run R (or RStudio) as an administrator (right-click on the .exe and "Run as Administrator" is an option) which should give it write access to your library.
Author by
Brandon
Updated on June 06, 2022Comments
-
Brandon almost 2 years
I'm having trouble installing ggplot2 into R. I've looked around here and haven't seen the same error that I'm getting.
> install.packages('ggplot2', dep=TRUE) Warning in install.packages("ggplot2", dep = TRUE) : 'lib = "C:/Program Files/R/R-2.13.1/library"' is not writable Error in install.packages("ggplot2", dep = TRUE) : unable to install packages Can anybody help?
-
Brandon over 12 yearsThanks for the reponse, I tried your suggestion and got the same error. How do I change the environment variable? I just installed R on the computer I'm using, could I have done something wrong when I installed R on my computer?
-
Anatoliy over 12 yearsThan you should create the directory for R libs, for example using the path I use, and supply it's path as a value for the
lib
argument. And after that, follow Dirk's advice :)