0

I am having real trouble understanding what my problem is installing ggplot package in Rstudio. I have tried a number of the post here and here but I still can't fix the problem.

I understand that I have a library directory on my Windows machine which can be found using:

.libPaths() which returns [1] "C:/Users/Bo Bo/Documents/R/win-library/3.2" "C:/Program Files/R/R-3.2.3/library"

I'm not sure what is stored in this directory using .Library but it looks to be pointing to the wrong directory, 3.2.3 and 32~1.3???:

[1] "C:/PROGRA~1/R/R-32~1.3/library"

Upon installing ggplot2

install.packages("ggplot2") returns:

Installing package into ‘C:/Users/Bo Bo/Documents/R/win-library/3.2’ (as ‘lib’ is unspecified) trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/ggplot2_2.1.0.zip' Content type 'application/zip' length 2001769 bytes (1.9 MB) downloaded 1.9 MB

package ‘ggplot2’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in C:\Users\Bo Bo\AppData\Local\Temp\Rtmp4QKdwV\downloaded_packages

So is it dumping the package in a temp directory because the 'lib' is unspecified? If so how do I specify the 'lib' and which library needs to change.

By the way I followed @Paweł Rumian post in link 2 above meaning I have a new User variable called R_LIBS_USER pointing to C:/Program Files/R/R-3.2.3/library

Can anyone make a suggestion as to how I can resolve this conflict and move on with my life :)

Community
  • 1
  • 1
TheGoat
  • 2,587
  • 3
  • 25
  • 58
  • I see no conflict. R always dumps a copy in a temp directory (which then gets erased later. This looks as though it should have succeeded. What happens when you type `library(ggplot2)`? – IRTFM Oct 14 '16 at 04:07
  • When running library(ggplot2) I got `Error in library(ggplot2) : there is no package called ‘ggplot2’` So I tried installing via install.packages("ggplot2") and I received a prompt saying: Warning in install.packages :'lib = "C:/Program Files/R/R-3.2.3/library"' is not writable -> "Would you like to use a personal library instead": `Warning in install.packages : cannot create dir 'C:\Program Files\R\R-3.2.3\library\file911c54e945eb', reason 'Permission denied' Error in install.packages : unable to create temporary directory ‘C:\Program Files\R\R-3.2.3\library\file911c54e945eb’` – TheGoat Oct 14 '16 at 07:05
  • Do I need to modify the permissions on R-3.2.3/library to read/write?? I read somewhere else on SO that it could be related to antivirus, any ideas?? – TheGoat Oct 14 '16 at 07:06
  • You do have a path entry in `.libPaths()` to a personal library which I'm guessing would have the correct permissions if it exists, which I would have expected to be used, but you might try specifying it (as the error message suggests) rather than letting the defaults remain in effect. – IRTFM Oct 14 '16 at 16:29
  • I reinstalled R and Rstudio this afternoon and I am still having the same issues. I checked the permissions on C:\Program Files\R\R-3.3.1\library and it was set to read only. I unselected read only and tried running my code again. Again I received the same warning: 'lib = "C:/Program Files/R/R-3.3.1/library"' is not writable. I checked the path properties again and it was reset to read only!!! – TheGoat Oct 15 '16 at 11:02
  • I've checked a number of folder permissions on my laptop and all of them have 'read only' permissions. I am running Win 10 and from doing a quick search there's known issues with Win 10 and read only permissions. Off to dig into this mess.... – TheGoat Oct 15 '16 at 12:29

1 Answers1

0

So I ended up re-installing windows after hours of trying to modify/fix the permissions issue I was having with all folders on the local disk.

Since re-installing I have installed Rstudio as per before and I am back in business, no messing around with library locations, just plain vanilla for me please...

TheGoat
  • 2,587
  • 3
  • 25
  • 58