Code results can be inserted directly into the text of a .Rmd file by enclosing the code with `r `. The file below uses `r ` twice to call colorFunc, which returns “heat.colors.” You can open the file here in RStudio Cloud.


Using `r ` makes it easy to update the report to refer to another function.


R Markdown will always

  • display the results of inline code, but not the code
  • apply relevant text formatting to the results

As a result, inline output is indistinguishable from the surrounding text. Inline expressions do not take knitr options.