Access is denied when Kniting RMD

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 '': Permission denied*

Execution halted

Thanks for anyone may help.

Are you on a network drive or something? I used to have issues working off them. I just moved the projects to the desktop and that fixed it.

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.

Hi Williaml. thanks for replying. It is installed on my desktop.

Hi melissagwolf, thanks for reply. the only file I had open is the R markdown file I wanted to knit.

Are all dependencies located in the same folder as your RMD file (e.g., images, datasets, etc)? Are you working out of your downloads folder?

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.


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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.