Session Ready
Exercise

Transforming variables

When variables have skewed distributions, they often require a transformation in order to form a linear relationship with another variable so that correlation can be computed. In this exercise, you'll perform a transformation yourself.

Both dplyr and ggplot2 are loaded and world_happiness is available.

Instructions 1/2
undefined XP
  • 1
    • Create a scatterplot of happiness_score vs. gdp_per_cap and calculate the correlation between them.
    • 2
      • Add a new column to world_happiness called log_gdp_per_cap that contains the log of gdp_per_cap.
      • Create a scatterplot of log_gdp_per_cap vs. happiness_score and calculate the correlation between them.