-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrural.Rmd
54 lines (46 loc) · 1.36 KB
/
rural.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
title: "rural.Rmd"
author: "Samruddhi Naik"
date: '2022-06-30'
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(tidycensus)
library(tidyverse)
library(ggthemes)
library(tigris)
```
The map that we made shows how rural the US states are.
```{r}
rural <- get_decennial(geography = "state",
variables = c("P001001", "P002005"),
year = 2010, output = "wide",
geometry = TRUE)
rural |>
filter(!NAME %in% c("Alaska", "Hawaii", "Puerto Rico")) |>
ggplot(aes(fill = (P002005/P001001)*100)) +
geom_sf() +
scale_fill_viridis_c(option = "plasma", direction = -1) +
labs(title = "Rural geography of the United States",
x = NULL, y = NULL,
fill = "Percent",
caption = "Source: Census 2010") +
theme_void()
```
```{r}
rural_shifted <- get_decennial(geography = "state",
variables = c("P001001", "P002005"),
year = 2010, output = "wide",
geometry = TRUE) |>
shift_geometry()
rural_shifted |>
ggplot(aes(fill = (P002005/P001001)*100)) +
geom_sf() +
scale_fill_viridis_c(option = "plasma", direction = -1) +
labs(title = "Rural geography of the United States",
x = NULL, y = NULL,
fill = "Percent",
caption = "Source: Census 2010") +
theme_void()
```