'R package access denied installation error

Error in install.packages : path[1]="\Users\name\Documents\R\win-library\4.1": Access is denied

I am trying to install basic r packages, and keep getting this error even though I have full permissions for this folder. I have tried different packages so it is something going on with my permissions.



Solution 1:[1]

Hey I figured it out using this guide I was confused because I had permissions to the document folder but because it was being backed up to the network I was getting an error. I also had to manually set permissions to the r-library files to make sure they weren't 'read only'

Solution 2:[2]

I have had this problem in the past. The way I fixed it was to close R, navigate to C:\Users\name\Documents in Windows Explorer, delete a file called '.Rhistory' located in that directory.

I then reopened R and then used the install.packages function as normal, and it ran with no problems.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Cbotelho
Solution 2