Description Usage Format See Also Examples
Data for 3143 counties in the United States. This dataset is equivalent to countyComplete
from the openintro
package.
1 |
An object of class data.frame
with 3143 rows and 53 columns.
US_regions
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()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.