I am attempting to make an R script that will write a csv file to my working directory daily for me to check. I am trying to use the
taskscheduleR package to do so, but it isn't behaving how I expected. Below is my code:
print("Running the Missing-Data Checker now.") source('./functions/missing_data_checker.R') # this file contains a function # to read in the data I need dats = missing_chkr(as.character(Sys.Date()-30)) # the afformentioned function missings = dats$missing_dats rm(dats) write.csv(missing, 'Missing_Data.csv', row.names = FALSE) print("The job has been run.)
To schedule the task, I simply use the code
taskscheduler_create('missing_data_check','./daily_missingdata_check.R', "ONCE", starttime = format(Sys.time() + 3700, "%H:%M"))
When the tasks runs, I see a window open up, but nothing happens. No csv files are written, and I don't think it even reads in the data. Any help on this topic would be greatly appreciated. Thanks!