tidyverse Instlallation

Hello all,

I am trying to install tidyverse package, but all the time I got the error messages like this:

Installing package into ‘C:/Users/User/OneDrive/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/tidyverse_1.3.0.zip'
Content type 'application/zip' length 439972 bytes (429 KB)
downloaded 429 KB

package ‘tidyverse’ successfully unpacked and MD5 sums checked
Error in install.packages : ERROR: failed to lock directory ‘C:\Users\User\OneDrive\Documents\R\win-library\4.0’ for modifying
Try removing ‘C:\Users\User\OneDrive\Documents\R\win-library\4.0/00LOCK’

Could you please help me how to deal with it?

Have you followed the advice on the error message?

Also, it is a known issue that R doesn't like cloud-synced folders, you would be better of by changing your package library to a non-synced folder.

I tried to remove the 00LOCK Directory, but in vain. Maybe, I was doing something in a wrong way as I am a beginner in R.

This is a very common error, particularly with institution controlled machines. When R is installing a package, it will create a 00LOCK folder to store copies of things whilst it installs. But then at the end, it tries to delete it, but can't because of a lack of admin rights.

This happens a lot with tidyverse because it's trying to install a bunch of packages.

The easiest solution is to set your own library path in your own directory, one where you can control (e.g. your Documents folder).

If you run the command .libPaths() it will give you a list of directories that R looks for its libraries. It searches them in order and if you try to install a new package, it tries in the first one. You need to add a new directory to this list.

Create a directory you want to use, copy & paste the directory and then insert it into this line of code:

.libPaths(c(r"(Your-Directory-Goes-Here)",.libPaths()))
1 Like

Thank You very much, it helped me

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.