The R code below can replicate this chart. You can get help installing R here.

You can get help with the tidycensus data retreival package here.

# Load R packages


library(tidycensus)
library(tidyverse)

# Get Data


population <- get_estimates(geography = 'state',
                             product = 'characteristics',
                             breakdown = c('SEX', 'AGEGROUP', 'HISP', 'RACE'), 
                             state = 'NM',
                             breakdown_labels = TRUE,
                             time_series = TRUE)

# Wrangle Data


population %>%
filter(

) %>%
mutate(
  RACE7 = case_when( # Carefully set mutually exclusive race-ethnicity categories.

    HISP == 'Hispanic' & RACE == 'All races' ~ 'Hispanic, any race',
    HISP == 'Non-Hispanic' & RACE == 'White alone' ~ 'White',
    HISP == 'Non-Hispanic' & RACE == 'Black alone' ~ 'Black',
    HISP == 'Non-Hispanic' & RACE == 'Asian alone' ~ 'Asian',
    HISP == 'Non-Hispanic' & RACE == 'Two or more races' ~ 'Two or more races',
    HISP == 'Non-Hispanic' & RACE == 'American Indian and Alaska Native alone' ~ 'American Indian and Alaska Native',
    HISP == 'Non-Hispanic' & RACE == 'Native Hawaiian and Other Pacific Islander alone' ~ 'Native Hawaiian and Other Pacific Islander',
    TRUE ~ 'Leftover'
  )
) %>%
filter(
  RACE7 != 'Leftover',
  SEX == 'Both sexes',
  str_detect(AGEGROUP, '^Age'),
  HISP != 'Both Hispanic Origins',
  DATE == 10
) %>%
ggplot() +
geom_bar(aes(x = AGEGROUP, y = value), stat = 'identity') +
facet_wrap(~RACE7, nrow = 2, labeller = label_wrap_gen(width = 15)) +
scale_y_continuous(labels = scales::comma) +
coord_flip() +
theme_bw() +
theme(axis.text.x = element_text(angle = -90, hjust = 0, vjust = .5)) +
labs(
  title = 'Estimated Population by Age and Race/Ethnicity - New Mexico',
  subtitle = 2017,
  y = '',
  x = '',
  caption = paste0('Source: U.S. Census Population Estimates, Data retreived on ', Sys.Date(), ', created by @StephenHolz')
  )