Not able to install packages in R studio

Description of issue - Downloaded R studio for the first time. Trying to install packages(readxl). When I write the command, a dialogue box appears asking me to use the personal directory or not. I have tried both options but still cannot install packages.
The following error message is coming up.


Warning in install.packages :
'lib = "C:/Program Files/R/R-4.0.3/library"' is not writable
Warning in install.packages :
cannot create dir 'C:\Users\bhaum\Documents\R', reason 'No such file or directory'
Error in install.packages : unable to create ‘C:/Users/bhaum/Documents/R/win-library/4.0’

I have also installed R tools but the result has been the same.

System Information:

  • RStudio Edition: Desktop version
  • RStudio Version: 1.4 (newest version)
  • OS Version: windows 64 bit
  • R Version: 4.0.3

Are you on a computer where you can't write to the 'C' drive?

This message is a usual one. Often you don't have write permission to where R is installed . When you only have this system library (and no personnal library), R will try to use the systeme library for installing package. But you don't have write access . This why you got this message

Warning in install.packages :
'lib = "C:/Program Files/R/R-4.0.3/library"' is not writable

That is why you are given a choice to use a personal directory when it is not created. This personal library is in your home folder, usually Documents/ on your user's space. However, in your case, it seems you don't have write access to this folder too.

Warning in install.packages :
cannot create dir 'C:\Users\bhaum\Documents\R', reason 'No such file or directory'
Error in install.packages : unable to create ‘C:/Users/bhaum/Documents/R/win-library/4.0’

Outside of R, are you able to create this folder in Documents/ ?

You need to have a R library folder in a space where you have write access.

Thank you all.
The access was blocked by windows security to create folders and directories from third-party applications.
I am able to install the packages now as I have turned on the access.

1 Like

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.