I'm trying to run a script once every minute using taskscheduleR
library. I'm following the examples from the GitHub page but am runing into the following problems:
- R says task created but the script does not execute properly (it should write data to a file in append mode - the file in question already exists)
- I do not see any log files - I believe they should be stored in the same location as the script being executed
- Deleting the task using
taskscheduler_delete("rds_task")
does not work
Here's my code:
taskscheduler_create(taskname = "rds_task",
rscript = "./Testing_Scheduler/testing_scheduler.R",
schedule = "MINUTE",
starttime = format(Sys.time() + 30, "%H:%M"),
startdate = format(Sys.time(), "%d/%m/%Y"),
modifier = 1)
And the contents of testing_scheduler.R
:
dat <- mtcars
data.table::fwrite(dat[1, ], "./Testing_Scheduler/testfile.txt", append = T)
To delete the task, I used:
taskscheduler_delete("rds_task")
which was unsuccessful. I ended up using the Windows Task Scheduler (my computer is in French - can't change that, sorry):
Same result with the R add-in except that I seem to be able to delete the task that way. I have admin rights on my computer (so it should not be an access-related problem).
Any help is appreciated!