如何每12小时编织一次markdown文件?

时间:2018-10-29 11:39:38

标签: r r-markdown

我有.Rmd文件,需要每12小时编织一次,并且文件名应包含Sys.Date()-1。

以下我使用的代码并出现错误:

rmarkdown::render("/home/saisaran/Project-2/Montly report.Rmd", 
                 output_file=sprintf('./DailyReports/LaunchDaily_%s.html', 
                 format(Sys.Date(), format = "%m-%d-%y")))

错误

Error: path for html_dependency not found: 

1 个答案:

答案 0 :(得分:0)

只有一个链接:如何通过带有Linux / Unix的cronR包的r studio调度R脚本。仍在寻找更准确的方法。.如果此处有任何更新。

R package details

示例代码

library(cronR)
f <- system.file(package = "cronR", "extdata", "helloworld.R")
cmd <- cron_rscript(f, rscript_args = c("productx", "20160101"))
## Every minute
cron_add(cmd, frequency = 'minutely', id = 'job1', description = 'Customers')
## Every hour at 20 past the hour on Monday and Tuesday
cron_add(cmd, frequency = 'hourly', id = 'job2', at = '00:20', description = 'Weather', days_of_week = c(1, 2))
## Every day at 14h20 on Sunday, Wednesday and Friday
cron_add(cmd, frequency = 'daily', id = 'job3', at = '14:20', days_of_week = c(0, 3, 5))
## Every starting day of the month at 10h30
cron_add(cmd, frequency = 'monthly', id = 'job4', at = '10:30', days_of_month = 'first', days_of_week = '*')
## Get all the jobs
cron_ls()
## Remove all scheduled jobs
cron_clear(ask=FALSE)