Exercise

Let's do some Logging

Let's look at the quartiles of mean zip code incomes in NC.

summary(high_inc$mean_income)

   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  55947   62380   71655   83682   90695  550849

The range is nearly $500,000! However, the median is much closer to the min than to the max, indicating a right-skew. Since the mean income variable contains exceptionally large values, the continuous color gradient is not very helpful. Log transforming a right-skewed variable pulls large values closer to the mean and yields a more symmetrically distributed variable.

Log transforming the mean income on our map increases the variation in the color gradient across the high income zip codes and enables better visualization of the distribution of mean income across the state.

Instructions

100 XP
  • Create a logged version of the nc_pal color palette.
  • Apply the logged color palette to the leaflet map.
  • Comment out the map tile from the leaflet map to more easily visualize the variation in mean income (add # without a space prior to the function that adds the map tile).