Reputation: 29
I am getting an error message while running knit to HTML. But If I run chunk individually, it draws plot as expected. What would be a problem? The error message is below:
Quitting from lines 270-274 (HC_FC_indivisual_cellline_fdr_1%.Rmd) Error in png(..., res = dpi, units = "in") : invalid 'filename' Calls: ... in_dir -> plot2dev -> do.call -> -> png Execution halted
Upvotes: 2
Views: 2552
Reputation: 1
I had the same problem. I updated R to the latest version and also RStudio. Install the required packages for the knit and then everything became fine. Adding 'dev.off()' can solve the problem for knitting but will cause another problem and does not show the plots in the HTML file.
Upvotes: 0
Reputation: 161
The described error also occurs, when you are knitting plots within named code chunks
, and the name of the chunk
does not lead to a valid path name during knitting process.
That is, during the knitting process the plots are written into a temporary path which contains the name of the code chunk
, ergo this name should contain only characters that are valid for path names. One should avoid to use white characters for chunk names
as well.
Upvotes: 7
Reputation: 29
I ran into the same issue. I ran this right before my first plot in the chunk and it solved it for me
dev.off()
hope this helps.
Upvotes: 1