ct-data-haven / cwi Goto Github PK
View Code? Open in Web Editor NEWR package for prepping and analyzing DataHaven's 2019 Community Index
Home Page: https://ct-data-haven.github.io/cwi/
License: Other
R package for prepping and analyzing DataHaven's 2019 Community Index
Home Page: https://ct-data-haven.github.io/cwi/
License: Other
For the docs site, some items in the reference are listed multiple times and in incorrect orders. Should be easy fix using pkgdown
setup...?
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.
2020 decennial uses sumfile labeled "dhc", not sf1 or sf3. Can use machine-readable table of available data: https://api.census.gov/data.html
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.
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?
Update acs_vars and remove 2016 version
Right now all the anti_xtabs functions are in a file together but not ready for deployment. They should be developed on another branch.
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.
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.
If there's no base_name included, names still get "_" at the beginning
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))
For now, change to get tracts / block groups without aggregating.
Maybe the neighborhoods argument could take a data frame instead of list, which includes a weight column, then uses that to aggregate.
Check if round_digits, else if sig_digits, else
By using mutate(across())
and pasting names, we're already halfway there. Switch value argument to ...
.
Line 54 in 846bc12
Currently, things won't work if tracts and their counties don't match up.
multi_geo_acs
and multi_geo_decennial
should add a column of the year used
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)
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.
stylehaven shouldn't depend on cwi---too much overhead---and add_logo makes more sense there anyway.
Trying to load tidyverse breaks Travis check. Adding namespacing is good first step to move anti_xtab functions into package.
turn
separate(label, into = c("total", "x1", "x2", "x3"), sep = "!!")
into
separate_acs(c("total", "x1", "x2", "x3"))
because I'm lazy
Calling
multi_geo_decennial("P018", year = 2000, regions = cwi::regions)
gets error:
Error in stri_replace_first_regex(string, pattern, fix_replacement(replacement), :
argumentstr
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.
Error:
:=
can only be used within a quasiquoted argument
when trying to fill weights
Set some threshold (20?) for verbose printing, so calls with lots of regions print "25 regions" but calls with fewer print names (currently what happens)
Shave away at a few dependencies that don't need to be there.
town_names
to cwiA declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.