Activity: Using Faceting to Understand Data

Steps for Completion:

  1. Use the loan data and plot a histogram (use fill color=cadetblue4 and bins=10).
  2. Use facet_wrap() to plot the loan data for the different credit grades.
  3. Now, you will need to change the default options for facet_wrap, in order to produce the following plots. Use ?facet_wrap on the command line to view the options that can be changed.

Outcome:

Refer to the complete code at the following path: https://goo.gl/RheL2G. The answers to the questions are given here:

  1. scale=free_y.
  2. A, B, and C have maximum loan amounts below 10,000. (A, B, C, and D is also an acceptable answer.)
  3. F and G show uniform distributions.
  4. No, none of the distributions are normally distributed.

Get Applied Data Visualization with R and ggplot2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.