Git Product home page Git Product logo

rcbpp's Introduction

Rcbpp

R-CMD-check Project Status: Active – The project has reached a stable, usable state and is being actively developed.

Overview

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.

Installation

To install Rcbpp, run the following code:

# install.packages("devtools")
devtools::install_github("CenterOnBudget/Rcbpp")

Example

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
  )
#> # A tibble: 3 × 4
#>   age_group         pop     b100 pov_rate
#>   <fct>           <dbl>    <dbl>    <dbl>
#> 1 Under 18     72777497  7044256   0.0968
#> 2 18 to 64    197582013 17446130   0.0883
#> 3 65 and over  55835929  5290704   0.0948

with(mar21, wt_quantile(a_age, wt = marsupwt, n = 10))
#> 10% 20% 30% 40% 50% 60% 70% 80% 90% 
#>   8  16  24  31  38  46  54  62  71

rcbpp's People

Contributors

matt-saenz avatar c-zippel avatar luisnnz avatar

Watchers

James Cloos avatar Nick Kasprak avatar

rcbpp's Issues

Not an issue - just saying hi!

Hi @matt-saenz! Came across this repo after your tidycensus comment. Just wanted to share that I've just started work on an internal R package at my org, @CSGJusticeCenter, and was just working on something similar to your SharePoint functions to access our data stored on SP.

I think I see what's going, but just so I'm clear: users sync SharePoint to their local machines and then the SP_DATA_PATH env variable is the path to the synced SP library on their local machine? On Windows, something like C:/Users/user_name/sharepoint_library?

I've also been playing around with the Microsoft365R package which allows for download and upload to SP via API -- not sure if you've tried that yet.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.