When working with R Markdown, there may be times where rather than having a chart or figure set off from the rest of your document, you may want to have the results of an R statement embedded directly within a line or paragraph of text. So, for example, if you were working on an HTML document using a dataset that changes over time, you could write your text and include R Markdown inline code.
The syntax is similar to a normal Code chunk but stripped down a bit. You use a tick mark around your code, and an r indicator followed by your code. This example displays the current time in your output document:
If you want to wrap that in text, you could have a line like this:
As of now `r Sys.time()`, the mean of the Car Speed data was: `r mean(cars$speed)`
Which generates results like this:
As I said earlier this is very handy when you are generating an HTML document, because both the system time and the result of the mean statement will be retrieved when the webpage is refreshed. It does have some use in PDF output, displaying when the document was generated and the mean value at that time.