-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPermits.Rmd
75 lines (54 loc) · 2.04 KB
/
Permits.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
title: "Single-family Permits"
author: "Jesse Wade"
date: "`r Sys.Date()`"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(tidyverse)
library(shiny)
```
# Read in Data from U.S. Census Bureau
I am reading in the data from the census. It gives the count for the the year and data. This particular dataset is set for June 2023, the most recent release of data. The next permits release is on August 16, which will be July permit data at the county level.
```{r Census_data, include=FALSE}
header <- scan("https://www2.census.gov/econ/bps/County/co2306y.txt",nlines= 1, what=character(),sep=",")
header2 <- scan("https://www2.census.gov/econ/bps/County/co2306y.txt",nlines= 1,skip=1 ,what=character(),sep=",")
data <- read.csv("https://www2.census.gov/econ/bps/County/co2306y.txt",skip= 3,header = FALSE)
names(data) <- paste0(header,header2,sep = "")
FipsToState <- read_csv("Data/FipsToState.csv")
data <- data[,1:18]
```
## Remove all multifamily permit data
```{r}
data %>%
select(c(1:9)) ->data_1
knitr::kable(head(data_1))
```
Data looks ready! :)
### County Level Analysis
#### Top Countys by Permits level
```{r Top_10_Permits}
data_1 %>%
left_join(FipsToState,by=c("FIPSState"="FIPS_Code"))%>%
mutate(CountyStateName =paste(CountyName,Postal_Abbr.,sep="") ) %>%
select(County=CountyStateName,Permits=8) %>%
arrange(desc(Permits)) %>%
top_n(20,Permits) -> Top_sf_Permit_Counties
knitr::kable(
Top_sf_Permit_Counties,caption = "Top 20 Single Family Permits in June 2023 by County"
)
```
### State Level Count
This data set is at the county level. It contains the current level of permits for the particular month by county
```{r States_Read}
data %>%
left_join(FipsToState,by=c("FIPSState"="FIPS_Code"))%>%
group_by(Postal_Abbr.) %>%
summarise(SingleFamilyPermits = sum(Bldgs)) %>%
arrange(desc(SingleFamilyPermits))-> State_Counts
knitr::kable(
State_Counts %>%
top_n(10,SingleFamilyPermits),caption = "Top 10 Single Family Permits in June 2023, Statewise"
)
```