R Markdown Error, Downloading packages for the first time

Hi, I am downloading R and RStudio for the first time for my Stats class and I am getting errors whenever I try to download the packages for R Markdown. I will try to attach a picture, but the error message is:

Error in unzip(zipname, exdir = dest) :
cannot open file 'C:/Users/Thadd-PC/Documents/R/win-library/3.6/file41b431f43778/xfun/DESCRIPTION': Permission denied
Calls: ... .install.winbinary -> unpackPkgZip -> .zip.unpack -> unzip
Execution halted

For fixes I have tried reinstalling R and RStudio, running RStudio as an admin, and trying to change file permissions. (But every time I try to change a folder permission, somehow it reverts back to read only). Assume I know very little information about file permissions and how to fix computers.

Try changing your library path to the system-level library before installing the packages (you have to be running RStudio as administrator for this to work).

.libPaths("C:\\Program Files\\R\\R-3.6.2\\library")
2 Likes

have you tried
install.packages("rmarkdown", dependencies = TRUE)

1 Like

Thank you for helping me!

It worked!! Thank you so much! You are a life saver!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.