For user-provided indicators and formulas, aggregate at each site and overall
Source:R/PROXIMITY_FUNCTIONS.R
doaggregate_newscores.Rd
Like doaggregate() but for any user-provided indicator available for all block groups (nationwide so that US percentiles make sense, or at least statewide)
Usage
doaggregate_newscores(
sites2blocks,
userstats,
formulas = NULL,
sites2states_or_latlon = NA,
radius = NULL,
countcols = "pop",
popmeancols = NULL,
calculatedcols = NULL,
varsneedpctiles = NULL,
usastats_newscores = NULL,
statestats_newscores = NULL,
...
)
Arguments
- sites2blocks
output of
getblocksnearby()
, as fordoaggregate()
- userstats
like blockgroupstats but data.frame or data.table of all US blockgroups and one or more columns of user provided raw indicator scores and any other variables needed for formulas to aggregate indicators across block groups in each site.
- formulas
a character vector of formulas in R code (see formulas_d for an example), that use variables in userstats to calculate any derived indicators or aggregated ones, for cases where just a sum or a population weighted mean is not the right way to aggregate some indicator. Formulas can include intermediate steps, or can aggregate across all places.
For example one formula might be
"pctover64 = ifelse(pop == 0, 0, over64 / pop)"
- sites2states_or_latlon
see
doaggregate()
- radius
see
doaggregate()
- countcols
see
doaggregate()
- popmeancols
see
doaggregate()
- calculatedcols
see
doaggregate()
- varsneedpctiles
see
doaggregate()
- usastats_newscores
calculated if not provided
- statestats_newscores
calculated if not provided
- ...
not used
Value
see doaggregate()