ComeçarComece de graça

Quick visual exploration of ACS margins of error

In Chapter 1, you learned how to create a dot plot of ACS income estimates. In this chapter, you've also learned about the importance of taking margins of error into account in ACS analyses. While margins of error are likely minimal for state-level estimates, they may be more significant for sub-state estimates, like counties. In this exercise, you'll learn how to visualize margins of error around estimates with ggplot2.

Este exercício faz parte do curso

Analyzing US Census Data in R

Ver curso

Instruções do exercício

  • Get a median household income dataset from the ACS for counties in Maine.
  • Use the geom_errorbarh() function in ggplot2 to create horizontal error bars defined by the margin of error around each estimate.
  • Add dots to your ggplot2 chart with geom_point().

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Request median household income data
maine_inc <- ___(___ = "county", 
                     variables = c(hhincome = "B19013_001"), 
                     ___ = "ME") 

# Generate horizontal error bars with dots
ggplot(___, aes(x = estimate, y = NAME)) + 
  ___(aes(xmin = estimate - moe, xmax = estimate + moe)) + 
  ___()
Editar e executar o código