Using the taskscheduleR
library I am trying to run a simple R script that creates a histogram of randomly distributed numbers.The script was set to run every 5 minutes. So I left R Studio open, expecting to see the histogram shape change every 5 minutes, but the scheduler never ran.
Please see the code for the'script' and'scheduler' below:
histogram.R script
rawData <- rnorm(10000)
hist(rawData,
col = "lightblue",
main = "Histogram of Random Data")
The code for the task scheduler is as follows:
library(taskscheduleR)
hscript <- "C:/Users/IFEANYI/Documents/RData/histogram.R"
run_script <- taskscheduler_create(
taskname = "Histogram",
rscript = hscript,
schedule = "MINUTE",
starttime = format(Sys.time() + 60, "%H:%M"),
modifier = 5
)
Any suggestion?