Schedule R script with taskscheduleR

Hey there,

I'm now trying for a long time scheduling the following R script, however it doesn't work no matter what I try.

library("rio")
library("ggplot")

path <- "path/to/tsvfile"
decData <- import(path)
g <- ggplot(decData,aes(x=TimeStamp,y=Current_nA)) +
  geom_line() +
  ylim(0,100)

plotPath <- paste0(dirname(path),"/Test.png")
ggsave(plotPath,plot=g,width=11.25, height=7.5, dpi=300)

For scheduling the script I tried the package "taskscheduleR" and set it up using its graphical interface and clicked "Done". No matter how long I wait a plot is not being created and also not saved under the provided path.
Can someone provide me information on how to schedule/automize the execution of a R script?

Would be happy if someone can help me.
Best
Max

Instead of taskscheduleR I saved the following text as a .bat file:

@echo on
"C:\Program Files\R\R-VERSION_NUMBER\bin\x64\R.exe" CMD BATCH "C:\Path\To\Your\ScriptToBeExecuted.R"

and scheduled the execution using the Windows Task Scheduler.

This topic was automatically closed 7 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.