-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
84 lines (63 loc) · 2.34 KB
/
README.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
71
72
73
74
75
76
77
78
79
80
81
82
83
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# **blockpop**: Estimate Census Block Populations for 2020 <a href='https://corymccartan.github.io/blockpop'><img src='man/figures/logo.png' align="right" height="320" style="padding: 12px" /></a>
<!-- badges: start -->
[![R-CMD-check](https://github.com/CoryMcCartan/blockpop/workflows/R-CMD-check/badge.svg)](https://github.com/CoryMcCartan/blockpop/actions)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
<!-- badges: end -->
2020 Census data is delayed and will be affected by differential privacy.
This package uses FCC block-level population estimates from 2010--2019, which
are based on new roads and map data, along with decennial Census and ACS data,
to estimate 2020 block populations, both overall and by major race/ethnicity
categories (using iterative proportional fitting).
## Installation
You can install the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("CoryMcCartan/blockpop")
```
## Usage
We start by downloading the FCC data locally (although you can skip this
step if you just want estimates for one state).
```{r include=F}
library(blockpop)
```
```{r eval=F}
library(blockpop)
bl_download_fcc("data-raw/fcc.csv")
```
Then we can extract the data for the state we care about and construct the 2020
block estimates.
```{r message=F}
library(dplyr)
fcc_d = bl_load_state("WA", "data-raw/fcc.csv")
block_d = bl_est_2020(fcc_d)
print(block_d)
summarize(block_d, across(starts_with("pop"), sum))
```
To add populations by race and ethnicity, we need to download ACS and 2010
Census data.
```{r include=F}
acs_d = readr::read_rds("data-raw/acs.rds")
census_d = readr::read_rds("data-raw/census2010.rds")
```
```{r eval=F}
acs_d = bl_download_acs_vars("WA")
census_d = bl_download_2010_vars("WA")
```
Then we call `bl_harmonize_vars()` to create block-level estimates
that still total to 2020 block populations and are close to ACS estimates at
the block group level.
```{r}
bl_harmonize_vars(block_d, census_d, acs_d)
```