Hello! We're just starting to use POSIT CONNECT to render and distribute reports in Quarto/RMarkdown and we've run into a bit of a snag. We need a report to be rendered and sent at 0730, 1530, and 1930. I know how to schedule this if we're wanting them at specific intervals (e.g., every 4 hours) using the "Schedule" tab, but how do we specify specific times that don't lie in fixed intervals without creating duplicate Rmds that are scheduled on different intervals (e.g., 0730 and 1930 and then a duplicate with a 1530 schedule)? Thanks!
I was able schedule it to run every 4 hours in the scheduler and then use
if (!(hour(Sys.time()) %in% c(7,15,19))) {knitr::knit_exit()}
to stop the rendering early and produce a blank html in the hours we're not wanting. Does anyone happen to know how to prevent this document from being sent out? We have the rendered HTML sent to end-users via "Send email after update" but we don't want to spam our end-users. Thanks!
And I just tried adding:
if (!(hour(Sys.time()) %in% c(7,15,19))) {
rmarkdown::output_metadata$set(rsc_email_supress_scheduled = TRUE)
rmarkdown::output_metadata$set(rsc_email_suppress_report_attachment = TRUE)
knitr::knit_exit(fully=TRUE)
}
But it still sent an e-mail. (idea based on R Markdown – Posit Connect Documentation Version 2025.02.0)
Ah ha!!! This did the trick! E-mail successfully supressed!
library(blastula)
if (!(hour(Sys.time()) %in% c(7,15,19))) {
suppress_scheduled_email()
knitr::knit_exit(fully=TRUE)
}