我正在尝试使用R的taskscheduleR包每隔十分之一分钟(每6秒)使用一个脚本下载数据。为此,我有一个名为getwmatadata.R的脚本,它从一个应用程序接口下载数据,我正在尝试使用基于以下链接的taskscheduleR调用此脚本:https://github.com/bnosac/taskscheduleR
然而,我的下面的脚本不工作,因为我得到一个错误
Error in taskscheduler_create(taskname = "wmatadata", rscript = wmatapinger, : File does not exist
下面是我尝试运行taskscheduleR的方式
library(taskscheduleR)
wmatapinger <- system.file("extdata", "getwmatadata.R", package = "taskscheduleR")
taskscheduler_create(taskname = "wmatadata", rscript = wmatapinger, schedule = "MINUTE", starttime = "05:00", modifier = 0.1)发布于 2017-08-21 23:31:46
我也收到了同样的错误。尽管我做了几次尝试(我一直收到错误"file in not exist"),但我最终还是能够通过GUI插件调度它来解决这个问题。
如果您使用的是RStudio,请转到Tools→Addins→"Schedule R scripts on…“。这最终对我起作用了。
发布于 2017-08-22 22:07:01
检查您指定的路径上是否存在.R文件。
file.exists(wmatapinger)发布于 2017-12-22 04:22:05
只需使用file.path()配置脚本的路径...不要使用system.file()
Solution:
wmatapinger <- file.path("C:", "name_of_the_folder", "wmatapinger.R")请参考file.path()如何构建路径(逗号表示正斜杠/ )
您的下一行代码很好,现在应该可以工作了。
https://stackoverflow.com/questions/44866371
复制相似问题