I'm trying to run this code in task manager. It runs successfully in Rstudio, but there is an error when I ran it in Task Manager. Here is the R code.
grDevices::dev.set(1)
library(ggplot2)
pdf(NULL)
options(bitmapType = 'cairo', device = 'pdf')
g <- ggplot()+geom_line(data = data.frame(a = 1:10, b = 21:30),
aes(x = a, y = b))
ggsave('path/graph.pdf',
g,
device = 'png')
The error when I ran it in Task Manager looks like this:
Error in (function (file = if (onefile) "Rplots.pdf" else "Rplot%03d.pdf", : cannot open file 'Rplots.pdf' Calls: -> Execution halted
The post below talks about the vanilla options
when calling Rscript...but I couldn't figure out what the solution is...