I'm an experienced R and knitr user, having used these since 2012, so I'm an old hand at trouble shooting problems, but this has me stumped. Actually, this issue is critical.
Here is the code that works without a problem:
<<configure, eval=TRUE>>=
rm(list = ls())
library(knitr)
library(ggplot2)
library(tidyr)
@
Here is the code that is causing the problem:
<<configure, eval=TRUE, dev='png', fig.width=4, fig.height=4>>=
rm(list = ls())
library(knitr)
library(ggplot2)
library(tidyr)
@
Here is the error message:
> knit2pdf("template.Rnw")
processing file: template.Rnw
|
| | 0%
|
|............. | 20%
ordinary text without R code
|
|.......................... | 40%
label: configure (with options)
List of 4
$ eval : logi TRUE
$ dev : chr "png"
$ fig.width : num 4
$ fig.height: num 4
Quitting from lines 43-47 (template.Rnw)
Error in (function (filename = "Rplot%03d.png", width = 480, height = 480, :
unable to start png() device
In addition: Warning messages:
1: In (function (filename = "Rplot%03d.png", width = 480, height = 480, :
unable to open file 'C:\Users\ccc31\AppData\Local\Temp\RtmpSwTCKI\file8e94649b2b62' for writing
2: In (function (filename = "Rplot%03d.png", width = 480, height = 480, :
opening device failed
I've been working on this file for at least six weeks without any problem whatsoever, but now it inexplicably fails. Two things have changed since I last ran it. (1) My McAfee Total Protection updated. (2) My Windows 10 OS installed an update. (3) Something else may have changed, but I wouldn't know what it is.
I am running R x64 3.5.1 using the console and running the command shown above. This is a critical project I'm working on and I have only a couple of days to finish it, so any help would be greatly appreciated. Thank you.