Description Usage Format References Examples
2016 median income by age, and reported for all races and broken down by race. In general, the non-exclusive data value (alone or in combination, "a.o.i.c.") was chosen.
1  | 
An object of class tbl_df (inherits from tbl, data.frame) with 42 rows and 4 columns.
United States Census Bureau
Downloaded on 02/11/2018 from: https://www.census.gov/data/tables/time-series/demo/income-poverty/historical-income-households.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23  | library(tidyverse)
income_by_age %>% filter(race == "all") %>%
  ggplot(aes(x = age, y = median_income)) +
    geom_col()
income_by_age %>% filter(race == "all") %>%
  ggplot(aes(x = fct_reorder(age, desc(median_income)), y = median_income)) +
    geom_col()
income_by_age %>% filter(race %in% c("white", "asian", "black", "hispanic")) %>%
  mutate(race = fct_relevel(race, c("asian", "white", "hispanic", "black"))) -> income_df
ggplot(income_df, aes(x = age, y = median_income, fill = race)) +
  geom_col(position = "dodge") +
  scale_fill_brewer(name = NULL) + theme_minimal_hgrid()
ggplot(income_df, aes(x = race, y = median_income, fill = age)) +
  geom_col(position = "dodge") +
  scale_fill_brewer(name = NULL) + theme_minimal_hgrid()
ggplot(income_df, aes(x = age, y = median_income)) +
  geom_col(position = "dodge") +
  facet_wrap(~race) + theme_minimal_hgrid()
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.