All Collections
Literate Programming
Rmarkdown
Knitting an Rmarkdown document
Knitting an Rmarkdown document

How to render Rmarkdown documents reproducibly and save the output to the results folder

Shahar Zaks avatar
Written by Shahar Zaks
Updated over a week ago

To publish on Code Ocean, we ask that code be executed as a whole, so it can serve as a reproducible record of the analysis from start to finish.

You can do this by kniting an Rmarkdown file into a final report in your /results folder. Add the following Rmarkdown::render command )from the Rmarkdown library) to your master script:

Rscript -e "rmarkdown::render(input = 'my-awesome-notebook.rmd', output_dir = '../results', clean = TRUE)"

Note: You may also need to add pandoc via apt-get, as well as LaTeX if you're rendering to PDF (here's how). See using Code Ocean's package management system.

Other Ways of Knitting an Rmarkdown Document

If you can also press the 'Knit' button from within an Rstudio Cloud Workstation session on Code Ocean.

Example Capsules using Rmarkdown

Did this answer your question?