Save Rmd file with code chunks and inline output for uploading


I need to submit an RMD file with both the code chunks and their output rendered inline, for a school assignment (the submission must be in Rmd format).
When I run my chunks in Rstudio, I do see the code and the output inline. I save the Rmd file and open it again, and I still see the code and output inline.
However when I upload the Rmd file or copy it to a different directory, and open the file, the output is no longer shown.
How can I save the Rmd file with both code and output embedded inline, so it can be shared with my professor ?
Here's what I have tried :

output: html_notebook
  chunk_output_type: inline

Settings -> Chunk Output Inline
Settings for each chunk -> Output -> Show code and output

Any inputs will be much appreciated. Thank you very much.



I think you have to render it to html using the knitr button. This way, with html_notebook format, you'll have an html file with all the chunk and result, and also a button so that the source Rmd file could be downloaded.

Otherwise, you have to share the all project.

The result you see under chunks and inline are cached result on your computer for easier development. The aim is to build the html file with this result.

1 Like


Thank you very much. I did not find this explanation anywhere else; I understand how it works now.



If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

1 Like

closed #5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.