knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
R utilities to streamline CBPP research, including functions for generating commonly used variables, creating paths to files in the SharePoint datasets library, and computing basic weighted statistics. Rcbpp also includes data that frequently come in handy, including state FIPS codes (along with corresponding state names and postal abbreviations) and calendar year averages of the CPI-U-RS.
To install Rcbpp, run the following code:
# install.packages("devtools") devtools::install_github("CenterOnBudget/Rcbpp")
library(Rcbpp) library(tidyverse) mar21 <- read_csv( file = sp_cps_asec(2021, f = "csv"), col_select = c(marsupwt, a_age, spm_resources, spm_povthreshold) ) mar21 |> make_age_group_var("cps_asec") |> mutate( pop = TRUE, b100 = spm_resources < spm_povthreshold ) |> group_by(age_group) |> summarize( across(c(pop, b100), \(x) wt_sum(x, wt = marsupwt)), .groups = "drop" ) |> mutate( across(c(pop, b100), round), pov_rate = b100 / pop ) with(mar21, wt_quantile(a_age, wt = marsupwt, n = 10))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.