Cannot update R Markdown

Hello, I am supernew to R. I wanted to open an RMarkdown file, but first I was prompted to run an update. THis is the error message:
Installing 'markdown' for R Markdown...

Installing package into 'C:/Users/ab1715/Dropbox/PC/Documents/R/win-library/4.1'
(as 'lib' is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/markdown_1.1.zip'
Content type 'application/zip' length 188691 bytes (184 KB)

downloaded 184 KB

package 'markdown' successfully unpacked and MD5 sums checked
Error in unpackPkgZip(foundpkgs[okp, 2L], foundpkgs[okp, 1L], lib, libs_only, :
ERROR: failed to lock directory 'C:\Users\ab1715\Dropbox\PC\Documents\R\win-library\4.1' for modifying
Try removing 'C:\Users\ab1715\Dropbox\PC\Documents\R\win-library\4.1/00LOCK'
Calls: sourceWithProgress ... eval -> -> .install.winbinary -> unpackPkgZip
Execution halted

Any help welcome!
Alberto

R has problems with cloud-synced folders (Dropbox in your case), I recommend you to set your package library in a non-synced folder.

You can change the default library folder by setting your R_LIBS_SITE environmental variable in a .Reviron or .Rprofile file. For example:

# In a .Renviron file you can set it by adding a line like this one with the desired location 
R_LIBS_SITE="C:\\Program Files\\R\\R-4.1.2\\library"

For a more detailed explanation, you can read this blog post

2 Likes

Thank you Andres, yes that was the reason --- solved,
best, Alberto

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

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.