Description Usage Arguments Details Examples
Simple wrapper of dplyr::select()
to drop ACS variable columns (estimates
or margins) created by acs_transform()
.
1 2 3 4 | acs_drop_vars(
.data,
type = c("all", "estimates", "margins", "standard errors")
)
|
.data |
[ |
type |
[character(1)]: The type of columns to drop. Must be one of:
|
This function simply wraps the dplyr
expression select(df, -matches("pattern"))
, where the regular expression is
"[bc]\\d{5}[a-z]*_e\\d{3}"
for estimates and "[bc]\\d{5}[a-z]*_m\\d{3}"
for margins.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | library(dplyr)
df <- tibble(
year = 2009L,
span = 1L,
b25070_e001 = c(1, 2, 3),
b25070_m001 = c(0.2, 0.5, 0.7),
b25070_e002 = c(3, NA, 1),
b25070_m002 = c(0.1, NA, 0.4)
)
acs_drop_vars(df, "estimates")
acs_drop_vars(df, "margins")
df %>%
mutate(foo = acs_est_sum("b25070_e{1:2*}")) %>%
acs_drop_vars("all")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.