Skip to content

Commit

Permalink
Merge pull request #126 from rossellhayes/feat/update-zcta
Browse files Browse the repository at this point in the history
Feat/update zcta
  • Loading branch information
1beb authored Dec 4, 2023
2 parents f51341a + ec10a95 commit 612ed1c
Show file tree
Hide file tree
Showing 35 changed files with 1,492 additions and 389 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.DS_Store

# History files
.Rhistory
.Rapp.history
Expand All @@ -8,6 +10,7 @@
# RStudio files
.Rproj.user/
.Rproj
.lazytest

# produced vignettes
vignettes/*.html
Expand All @@ -21,4 +24,4 @@ vignettes/*.pdf
src/RcppExports.o
src/aux_funs.o
src/sample_me.o
src/wru.so
src/wru.so
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ Imports:
rlang
Suggests:
covr,
testthat (>= 3.0.0)
testthat (>= 3.0.0),
tidycensus
LinkingTo:
Rcpp,
RcppArmadillo
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ importFrom(dplyr,pull)
importFrom(furrr,future_map_dfr)
importFrom(piggyback,pb_download)
importFrom(purrr,map_dfr)
importFrom(rlang,"%||%")
importFrom(stats,rmultinom)
importFrom(utils,setTxtProgressBar)
importFrom(utils,txtProgressBar)
Expand Down
20 changes: 3 additions & 17 deletions R/census_data_preflight.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,12 @@
#' @keywords internal

census_data_preflight <- function(census.data, census.geo, year) {

if (year != "2020"){
vars_ <- c(
pop_white = 'P005003', pop_black = 'P005004',
pop_aian = 'P005005', pop_asian = 'P005006',
pop_nhpi = 'P005007', pop_other = 'P005008',
pop_two = 'P005009', pop_hisp = 'P005010'
)
} else {
vars_ <- c(
pop_white = 'P2_005N', pop_black = 'P2_006N',
pop_aian = 'P2_007N', pop_asian = 'P2_008N',
pop_nhpi = 'P2_009N', pop_other = 'P2_010N',
pop_two = 'P2_011N', pop_hisp = 'P2_002N'
)
}
vars_ <- unlist(census_geo_api_names(year = year))
legacy_vars <- unlist(census_geo_api_names_legacy(year = year))

test <- lapply(census.data, function(x) {
nms_to_test <- names(x[[census.geo]])
all(vars_ %in% nms_to_test)
all(vars_ %in% nms_to_test) || all(legacy_vars %in% nms_to_test)
})
missings <- names(test)[!unlist(test)]

Expand Down
Loading

0 comments on commit 612ed1c

Please sign in to comment.