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 ejercicio forma parte del curso
Analyzing US Census Data in R
Instrucciones del ejercicio
- 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().
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
# 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)) +
___()