Skip to content

Commit

Permalink
Add reliability support to get_acs_tables
Browse files Browse the repository at this point in the history
  • Loading branch information
elipousson committed Jun 10, 2024
1 parent 609de7e commit cb3a726
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
21 changes: 19 additions & 2 deletions R/get_acs_ext.R
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,12 @@ get_acs_tables <- function(geography,
year = 2022,
survey = "acs5",
variables = NULL,
moe_level = 90,
...,
crs = NULL,
label = TRUE,
perc = TRUE,
reliability = FALSE,
keep_geography = TRUE,
geoid_col = "GEOID",
quiet = FALSE,
Expand All @@ -156,7 +158,12 @@ get_acs_tables <- function(geography,
variable_labels <- NULL

if (is_character(variables) && is_named(variables)) {
variable_labels <- tibble::enframe(variables, name = "variable", value = "variable_id")
variable_labels <- tibble::enframe(
variables,
name = "variable",
value = "variable_id"
)

variable_col <- "variable_id"
}

Expand Down Expand Up @@ -185,6 +192,7 @@ get_acs_tables <- function(geography,
year = year,
survey = survey,
variables = variables,
moe_level = moe_level,
...,
.fn = .fn,
.call = call
Expand All @@ -193,9 +201,16 @@ get_acs_tables <- function(geography,
acs_data <- list_rbind(acs_list)

if (keep_geography) {
geography_cols <- as.data.frame(
do.call(
cbind,
get_geography_params(geography = geography, year = year, ...)
)
)

acs_data <- vctrs::vec_cbind(
acs_data,
as.data.frame(do.call(cbind, get_geography_params(geography = geography, year = year, ...))),
geography_cols,
.error_call = call
)
}
Expand Down Expand Up @@ -233,6 +248,8 @@ get_acs_tables <- function(geography,
survey = survey,
year = year,
perc = perc,
reliability = reliability,
moe_level = moe_level,
geoid_col = geoid_col,
variable_col = variable_col
)
Expand Down
8 changes: 5 additions & 3 deletions man/get_acs_metadata.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions man/get_acs_tables.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cb3a726

Please sign in to comment.