简体   繁体   中英

how to knit r markdown file for every 12 hours?

I have the .Rmd file and it needs to be knit for every 12 hours also file name should include Sys.Date()-1.

below code i used and getting error :

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

error

Error: path for html_dependency not found: 

Got one link : how to schedule R scripts through r studio with cronR package for linux/Unix. still searching for more accurate methods..if anything will update here.

R package details

sample code

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM