Session Ready
Exercise

Referencing code results in the report

In this exercise, you'll use summarize() and brazil_investment_projects_2018 to find the total investment amount for all projects in Brazil in the 2018 fiscal year. Then, you'll add text to the report to include the information and reference the code results in the text, so that the calculated amount is printed in the text of the report when you knit the file.

Instructions
100 XP
  • In the brazil-investment-projects-2018 code chunk, create brazil_investment_projects_2018_total by summarizing the data that was filtered for projects in Brazil in the 2018 fiscal year to create a new column, sum_total_investment, that contains the sum of the total_investment amounts for each of the projects.
  • Add Brazil and 2018 to the sentence on line 47 to describe the information that was calculated.
  • Add a reference to brazil_investment_projects_2018_total in the sentence on line 47, so that the total investment amount for all projects in Brazil in the 2018 fiscal year is included in the knit report.