I can't install packages although I have removed 00lock

Hey!
I can't install any packages, and although I have removed 00'lock, it still tells me:
package ‘InformationValue’ successfully unpacked and MD5 sums checked
Error in install.packages : ERROR: failed to lock directory ‘C:\Users\Lukas\OneDrive\Documents\R\win-library\4.1’ for modifying
Try removing ‘C:\Users\Lukas\OneDrive\Documents\R\win-library\4.1/00LOCK’
It's windows

Does anybody have a clue about what's wrong?

Have a nice day
Lukas

I am absolutely not certain, but I would start checking if it is a OneDrive-issue. Try to install in a folder outside OneDrive:
install.packages("packagename",lib="c:/Users/Lukas/R/....")
or something like that.
I also think that if you can upgrade to R4.2 it will automatically choose a folder outside OneDrive when you install packages.

/Thomas

R has problems with cloud-synced folders (OneDrive 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.2.0\\library"

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