r - 如何使用 taskscheduleR 自动化 R 中的脚本?
问题描述
我目前正在查看此文档,以使用 R 和 taskscheduleR 在我的机器上自动执行脚本。我对以下文档感到困惑:
在文档中的示例中,什么是“extdata”,这应该是我的 R 脚本的文件路径,而“helloworld.R”是实际的 R 脚本吗?
myscript <- system.file("extdata", "helloworld.R", package = "taskscheduleR")
我目前对此的看法如下: C:/Users/santi/Documents/R Scripts 是我的文件路径,Wayerhaeuser_Automation_script.R 是我的实际 R 脚本
myscript <- system.file("C:/Users/santi/Documents/R Scripts", "Wayerhaeuser_Automation_script.R", package = "taskscheduleR")
taskscheduler_create(taskname = "myfancyscript", rscript = myscript,
schedule = "ONCE", starttime = format(Sys.time() + 62, "%H:%M"))
我对它的文档有点困惑。
解决方案
更改myscript
为:
myscript <- paste0("C:/Users/santi/Documents/R Scripts/","Wayerhaeuser_Automation_script.R")
它应该可以正常工作。该rscript
参数只是要运行的文件的字符串路径。如果有空格,有时路径会被错误地解释,所以如果它不起作用,还可以尝试将文件夹名称更改为 R_Scripts
推荐阅读
- javascript - TweenMax / GSAP 错开原始数组值
- python - 有没有一种方法可以根据同一序列化程序中另一个字段的值来初始化 django REST 序列化程序的属性值?
- swift - swift 4中两个节点之间的碰撞检测
- curl - 无法更改neo4j密码
- rpm - 了解 rpm 规范文件中的构建部分
- eloquent - Laravel-5.6 中的关系
- typescript - Typescript:字符串文字类型以区分另一种属性类型;
- javascript - nodejs Separate array
- laravel - 碳比较日期检查日期日期是否等于当天
- ansible - ANSIBLE - 对问题回答是否