I've come across this issue regarding "error in install.packages". This is what I get from Rstudio when I was trying to install packages:
package ‘downloader’ successfully unpacked and MD5 sums checked
Error in install.packages : ERROR: failed to lock directory ‘C:\Users\User\Documents\R\win-library\3.6’ for modifying
Try removing ‘C:\Users\User\Documents\R\win-library\3.6/00LOCK’
Have you tried going to the folder C:\Users\User\Documents\R\win-library\3.6 and removing the file whose name starts with 00LOCK? To see this file, you may have to make hidden items visible, which I believe is an option under the View menu of the folder.