Code Monkey home page Code Monkey logo

cwi's People

Contributors

18kimn avatar camille-s avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cwi's Issues

handling COGs

As of August 2023, tidycensus has COGs included in their fips code lookup, but AFAIK none of our sources actually have COG data in their APIs. Right now this is causing errors with the QWI API. For now I'll restrict get_county_fips to the original 8 counties, but this is a reminder to keep an eye on any sources adding COGs, in which case I'll need to adjust.

Check sumfile in multi_geo_decennial printing

When printing table information, SF3 headings might be displayed for the same table number on SF1. e.g. 2000 P037 is group quarters in sf1, education in sf3, the heading info that prints is for group quarters. Data that's pulled is fine.

large geos xwalk df

Would it be useful to have one df that had towns, their counties, their PUMAs, their metros, etc. Basically all the groupings that a town might belong to that also have GEOIDs?

Incorporate anti_xtabs functions

Right now all the anti_xtabs functions are in a file together but not ready for deployment. They should be developed on another branch.

multi_geo_* should take tract or block group

Add handling for block groups vs tracts by taking argument block_groups = F (default false = defaults to tracts). Should also return warning if there's a mismatch between level specified and number of digits in FIPS codes.

change cost burden table number

2022 ACs has a better table for housing cost burden. Move mortgage & rent tables to extended table numbers, add new one to basic table numbers.

multi_geo_* level revision

In order to avoid having misaligned levels when using multi_geo_* and multiple years including 2022, can we re-level the groups?

counties = always the original 8 counties
cogs = always cogs
regions = DataHaven regions i.e., 6WFC, NHIR, etc.

yrs <- c(2022, 2012)

df <- yrs |> purrr::map(~cwi::multi_geo_acs(year = ., table = "B01003", towns = "all", counties = "all", regions = cwi::regions)) |>
dplyr::bind_rows() |>
dplyr::select(year, level, name) |>
dplyr::filter(grepl("COG", name))

View(unique(df))

Specify counties for towns in multi_geo_acs for 2010

library(tidycensus)
# no error
get_acs("county subdivision", variables = "B01003_001", state = "09", year = 2010, county = "09")
#> Getting data from the 2006-2010 5-year ACS
#> # A tibble: 28 x 5
#>    GEOID    NAME                                  variable  estimate   moe
#>    <chr>    <chr>                                 <chr>        <dbl> <dbl>
#>  1 0900900… County subdivisions not defined, New… B01003_0…        0   123
#>  2 0900901… Ansonia town, New Haven County, Conn… B01003_0…    19163    45
#>  3 0900903… Beacon Falls town, New Haven County,… B01003_0…     5909    18
#>  4 0900904… Bethany town, New Haven County, Conn… B01003_0…     5467    34
#>  5 0900907… Branford town, New Haven County, Con… B01003_0…    28194    31
#>  6 0900914… Cheshire town, New Haven County, Con… B01003_0…    29183    25
#>  7 0900919… Derby town, New Haven County, Connec… B01003_0…    12826    20
#>  8 0900922… East Haven town, New Haven County, C… B01003_0…    29074    26
#>  9 0900934… Guilford town, New Haven County, Con… B01003_0…    22222    35
#> 10 0900935… Hamden town, New Haven County, Conne… B01003_0…    60293    32
#> # ... with 18 more rows

# error on geography hierarchy
get_acs("county subdivision", variables = "B01003_001", state = "09", year = 2010)
#> Getting data from the 2006-2010 5-year ACS
#> Error: Your API call has errors.  The API message returned is error: unknown/unsupported geography heirarchy.

Created on 2018-11-11 by the reprex package (v0.2.1)

Add "research series" option in adj_inflation

blscrapeR package uses BLS series CUSR0000SA0. To compare monetary values from before 2000, Census says to use CPI-U-RS, the research series. For example, base CPI had Connecticut's 1990 median household income as $78,276; using CPI-U-RS has $76,106. adj_inflation could take an argument to flag which of these to use, although I can't find a series number for the RS version.

Fix namespacing in anti_xtabs

Trying to load tidyverse breaks Travis check. Adding namespacing is good first step to move anti_xtab functions into package.

separate_acs

turn

separate(label, into = c("total", "x1", "x2", "x3"), sep = "!!")

into

separate_acs(c("total", "x1", "x2", "x3"))

because I'm lazy

Error in gathering decennial in `multi_geo_decennial`

Calling

multi_geo_decennial("P018", year = 2000, regions = cwi::regions)

gets error:

Error in stri_replace_first_regex(string, pattern, fix_replacement(replacement), :
argument str should be a character vector (or an object coercible to)
Error in gather_(data, key_col = compat_as_lazy(enquo(key)), value_col = compat_as_lazy(enquo(value)), :
unused argument (-NAME)

Removing regions works fine.

dependency cleanup

Shave away at a few dependencies that don't need to be there.

  • blscrapeR
  • ~~ [ ] jsonlite?~~ httr imports this anyway, so leave it
  • ggrepel
  • censusapi
  • sf?
  • camiller—move town_names to cwi
  • readr—other than batch_csv_dump, only used in data creation, not functions

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.