Is it possible to take an rmarkdown file, programmatically manipulate chunk options, and then knit based on the modified document?
I have some rmarkdown files that I want to purl, with all code (even ones with eval=FALSE) included.
At this point, my best guess is that I could (1) use sed to switch eval=FALSE to eval=TRUE, and then (2) purl. But I'd love if there's something nicer, for example maybe like:
parsed_rmd <- knitr::parse_rmd('my_rmarkdown.rmd')
for (chunk in parsed_rmd) {
chunk$eval <- TRUE
}
knitr::purl(parsed_rmd, output = 'my_rmarkdown_as_r.R'