After completing this tutorial, you will be able to:
- Add a variable to the Markdown chunk in your rmd report.
What You Need
You will need a computer with internet access to complete this lesson and the data for week 8 of the course.
Automating Report Content
Let’s pretend that you’ve calculated a value in your code and you want to include it in your R Markdown report but you don’t want to include the code. Maybe it’s a number that you want to appear in the TEXT of your report - not as a code chunk output. How do you do that?
total_area <- (800 * 7) / 2
You can add any variable that you want to a report using the syntax
However replace the double quotes “” with ticks `
There are 2800 km of burned area according to modis.
Where the markdown text is surrounded by ticks. Followed by the language “r” and then the variable that you want to print in your report! This is very useful when you are trying to create a fully automated report. As you update the data, the output numbers if your report also update!