Analyze a fusionACS microdata pseudo-sample created by assemble. Efficiently computes means, medians, sums, proportions, and counts of specified variables, optionally across population subgroups.
Usage
analyze(data, ..., by = NULL, fun = NULL, cores = get_cores())
Arguments
- data
Data frame. fusionACS microdata pseudo-sample returned by assemble.
- ...
Formulas. Used to define the desired analyses. See Examples.
- by
Optional variable(s) that collectively define the set of population subgroups for which each analysis is computed. Can be a mix of geographic (e.g. census tract) and/or socio-demographic microdata variables (e.g. poverty status); the latter may be existing variables on disk or custom variables created on-the-fly via
fun()
. IfNULL
, analysis is done for the whole (national) sample.- fun
Function. Optional function for modifying
data
prior to analysis.- cores
Integer. Number of cores used for multithreading in
collapse-package
functions. The default is one less than the total available cores.
Examples
my.data <- assemble(
variables = c(hincp, np, btung, totsqft_en, acequipm_pub, state_name, county10, tract10),
year = 2019,
respondent = "household",
state_name == "Texas"
)
test <- analyze(
data = my.data,
mean_btung ~ mean(btung),
~median(totsqft_en),
~mean(acequipm_pub),
by = list(np, c(state_name, county10, tract10))
)