Unable to install ggplot2
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.packag开发者_运维问答es('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?
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.
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.
In RStudio:
- Try going to "Tools";
- At the top you have "Install packages", click on that;
- Then click on "Install to Library", change that to another library and save there.
精彩评论