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 6 of the course.
Automating report content
Let’s pretend that we’ve calculated a value in our code and we want to include it in our R Markdown report but we don’t want to include the code. Maybe it’s a number that we want to appear in the TEXT of our report - not as a code chunk output. How do we do that?
total_area <- (800 * 7) / 2
We can add any variable that we 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 we want to print in our report! This is very useful when we are trying to create a fully automated report. As we update the data, the output numbers if our report also update!