I am running into an issue when trying to knit Rmd.
If I tried to knit to PDF or Word, an error window would pop-up immediately, which says: Error Saving File: Access is denied. When tried to knit to HTML, the following error showed in my Rstudio Console |............ | 17% label: hist-weight
*Error in file(file, ifelse(append, "a", "w")) : *
cannot open the connection* Calls: ... -> png -> .handleSimpleError -> h -> cat -> file In addition: Warning messages: 1: In dir.create(dirname(name), recursive = TRUE) :
cannot create dir 'bayesian_inference_files', reason 'Permission denied'* 2: In png(..., res = dpi, units = "in") :
unable to open file 'bayesian_inference_files/figure-html/hist-weight-1.png' for writing* 3: In png(..., res = dpi, units = "in") : opening device failed 4: In file(file, ifelse(append, "a", "w")) :
cannot open file 'bayesian_inference.knit.md': Permission denied*
This might seem silly, but do you already have the file open? You'll get a permission denied error message if you already have the file open and you're trying to overwrite it.
I have it figured out.
This Rmd is placed in a specific user's folder under my window's C:\Uswers folder and Rstudio does not have the right to write to the folder (e.g create files generated by knit).
I moved the Rmd to another public folder and it could be knit with no problem.
What I don't understand is I am logging in with this specific user profile and this user is also an administrator user and why Rsutdio does not have its right to manipulate this user folder.