1. Learn
  2. /
  3. Courses
  4. /
  5. Visualizing Big Data with Trelliscope in R

Exercise

Adding custom cognostics

Let's create some custom cognostics. To do so, you'll add two new variables to the gapminder data: delta_lifeExp and ihme_link.

Instructions

100 XP
  • Add a new variable called delta_lifeExp to the gapminder data that computes the difference between the first and last observed life expectancy (lifeExp) for each country (grouping variable). Note that the data is already sorted by year.
  • Add another variable, ihme_link that links to the country's profile on healthdata.org, using space_to_dash() to replace spaces in country values to dashes. For example, for the country "Costa Rica", the link is "http://www.healthdata.org/Costa-Rica".
  • Give the delta_lifeExp variable a description of "Overall change in life expectancy".
  • Specify default_label = TRUE to make the ihme_link variable be shown as a label by default.