I have a R script which calls another RMarkdown script in order to create an RMarkdown HTML document for each row in a dataframe column. Here’s the basic script:
render_one <- function(case) {
# assuming the output format of input.Rmd is PDF
rmarkdown::render(
"X:/private/my_script.Rmd",
output_file = paste0("X:/private/output", 'timeline_',case, '.html'),
params = list(case=case),
envir = parent.frame()
)
}
for (case in timeline_data$case_id) {
render_one(case)
}
The script runs fine for awhile, but eventually throws this error:
! Recv failure: Connection was reset
Backtrace:
1. RCurl::postForm(...)
3. RCurl (local) `<fn>`(35L, "Recv failure: Connection was reset", TRUE)
This error only started happening after I updated R Studio. It happens when I leave this script running and step away from my computer; i.e. maybe it’s timing out.
It worked fine with prior versions of R Studio. How can I solve this?
1