US_census: US census data at the county level

Description Usage Format See Also Examples

Description

Data for 3143 counties in the United States. This dataset is equivalent to countyComplete from the openintro package.

Usage

1

Format

An object of class data.frame with 3143 rows and 53 columns.

See Also

US_regions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
library(dplyr)
library(ggplot2)

data <- left_join(US_census, US_regions) %>%
 group_by(region, division, state) %>%
 summarize(pop2000 = sum(pop2000, na.rm = TRUE),
           pop2010 = sum(pop2010, na.rm = TRUE),
           popgrowth = (pop2010-pop2000)/pop2000,
           area = sum(area)) %>%
 arrange(popgrowth) %>%
 ungroup() %>%
 mutate(state = factor(state, levels = state),
        region = factor(region, levels = c("West", "South", "Midwest", "Northeast")))


ggplot(data, aes(x = state, y = popgrowth, fill = region)) + geom_col() + coord_flip()

clauswilke/dviz.supp documentation built on Aug. 25, 2020, 2:12 a.m.