在R Run taskscheduler每天同时运行

时间:2017-06-20 16:32:38

标签: r scheduled-tasks taskscheduler rautomation

请有人帮我设置一个脚本,每天晚上11点自动运行? 我找到了包“taskscheduleR”,但我不知道如何用它来运行我的脚本。

提前感谢!

taskschedulerR例如:

myscript <- system.file("extdata", "helloworld.R", package = "taskscheduleR")

## run script once within 62 seconds taskscheduler_create(taskname = "myfancyscript", rscript = myscript, schedule = "ONCE", starttime = format(Sys.time() + 62, "%H:%M"))

我的剧本

dayfile <- read.csv("A:/file_170611.txt", sep = " ", header=F, stringsAsFactors = F)
write.table(dayfile, file="A:/dayfiles/dayfile.txt", sep = " ")

1 个答案:

答案 0 :(得分:3)

README of taskscheduleR看起来非常重要:

library(taskscheduleR)
myscript <- "A:/script.R" # path to script
taskscheduler_create(taskname = "myscriptdaily", rscript = myscript, 
    schedule = "DAILY", starttime = "09:10", 
    startdate = format(Sys.Date()+1, "%d/%m/%Y")
)

你已经完成了。