knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
y2municipal
is the flagship package from Y2 Analytics to automate municipal reports. It relies heavily on other y2 packages, y2clerk
and orderlabel
, so be sure to have those installed first.
The goal of y2municipal
is to quickly and easily go through the standard processes used in every municipal project of:
1) Clean the voter file:
2) Weight the data:
3) Create a topline report: topline()
- uses freqs(unweighted_ns = TRUE under the hood)
4) Load in data, y2 fonts, and create a names df: read_data_names_fonts()
5) Create visualizations:
And the development version from GitHub with:
# install.packages("devtools") devtools::install_github("nick-moffitt/y2municipal")
Below you will find a few basic examples which show you how to quickly get a frequencies table with freqs()
:
library(dplyr) library(y2clerk) library(orderlabel) library(y2municipal) # Run a weighted frequencies with unweighted ns frequencies <- municipal_data %>% freqs_wuw(s_sex) # Run a topline DATA_PATH <- '~/Desktop/' municipal_data %>% topline(weight_var = weights)
If you have issues using y2municipal, please post your issue on GitHub along with a minimal reproducible example. We will do our best to address your issues and get them fixed for the next version of y2municipal.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.