-
Notifications
You must be signed in to change notification settings - Fork 4
/
README.Rmd
106 lines (74 loc) · 2.5 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
<!-- badges here -->
[![CRAN status](https://www.r-pkg.org/badges/version/tidyqwi)](https://cran.r-project.org/package=tidyqwi)
[![R build status](https://github.com/medewitt/tidyqwi/workflows/R-CMD-check/badge.svg)](https://github.com/medewitt/tidyqwi/actions)
<!-- end badges -->
# tidyqwi
The goal of `tidyqwi` is to make accessing the US Census Bureau's _Quarterly Workforce Indicators_ easier in a tidy format.
This package allows a user to specify the years and states of interest as well as some of the additional parameters (desired cross tabs, MSA vs county level data, firm size, etc) and submit them to the US Census API.
This package then stays within the US Census guidelines for API submission for this data and returns a combined tidy dataframe for future analysis.
## Installation
Install via CRAN with:
```{r eval=FALSE}
install.packages("tidyqwi")
```
Or the development version at:
```{r eval=FALSE}
remotes::install_github("medewitt/tidyqwi")
```
## Use
After installation you can load and retrieve the desired data!
```{r eval=FALSE}
library(tidyqwi)
nc_qwi <- get_qwi(years = "2010",
states = "11",
geography = "county",
apikey = census_key,
endpoint = "rh",
variables = c("sEmp", "Emp"), all_groups = FALSE,
industry_level = "2", processing = "multiprocess")
```
```{r include=FALSE}
library(tidyqwi)
```
And look at your data:
```{r}
head(nc_qwi)
```
And there are labels added if desired
```{r}
labelled_nc <- add_qwi_labels(nc_qwi)
```
```{r}
Hmisc::describe(labelled_nc$Emp)
```
```{r}
library(ggplot2)
library(dplyr)
labelled_nc %>%
as_tibble() %>%
dplyr::filter(county == "067") %>%
ggplot(aes(year_time, Emp, color = county))+
geom_line()+
scale_y_log10()+
facet_wrap(~industry)+
labs(
title = "Quarterly Workforce Indicators for Forsyth County",
subtitle = attributes(labelled_nc$Emp)$label,
caption = "Data: US Census Bureau QWI",
x = "Month"
)+
theme_minimal()
```
Please note that the 'tidyqwi' project is released with a [Contributor Code of Conduct](https://github.com/medewitt/tidyqwi/blob/main/CODE_OF_CONDUCT.md). By contributing to this project, you agree to abide by its terms.