Lesson 1. Add Variables to an RMD Report R.
Refine Plots & Add Variables to Rmarkdown Reports - Earth analytics course module
Welcome to the first lesson in the Refine Plots & Add Variables to Rmarkdown Reports module. This tutorial set covers some basic things you can do to refine your plots in Rmarkdown document. It covers plotting in grids, adding titles to plotRGB() plots and refining the width and height of plots to optimize space.Learning Objectives
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
"r total_area"
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!
Leave a Comment