A More Complex Example: Medicare Data

To help show how to use ggplot2 to solve problems, and to better understand the grammar of graphics, I’ll use a real, complicated data example: U.S. Medicare cost and outcome data. See Medicare Data for more information.

Let’s start with a simple example: average mortality and readmission rates for three common medical conditions. We’d like to compare national treatment effectiveness statistics for three common diseases. This is a fairly simple data set: there is one dimension (the readmission rate), three conditions (Heart Attack, Heart Failure, and Pneumonia), and one factor variable (Measure) ...

Get R in a Nutshell, 2nd Edition 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.