Convince me to start using R Markdown

I recently had a similar issue -- each part of the project was its own R Markdown file (since we liked the ability to turn it into reports, and we found commenting more intuitive)

When we wanted to run it together, we found a sort of hacky way to do it, not sure if it made sense - but essentially, we created a master markdown document, and ran each subdocument in turn - by using knitr:knit("subfile1.Rmd", output = tempfile(), quiet = TRUE). The big problem is then we couldn't run the entire document at once -- since each document had chunk called "setup"...however, it worked for our needs.

We actually did it a bit more complicatedly than I described above (by wrapping each one in a function, and then calling the function, so as to ensure that we only got back one item from each markdown document, so there wouldn't be extra objects floating around our environment), but the above way could work.

The other thing we thought of doing is running source(knitr::purl("subfile1.Rmd", output = tempfile, quiet = TRUE)), but I got scared off by http://r.789695.n4.nabble.com/R-CMD-check-for-the-R-code-from-vignettes-td4691457.html

1 Like