Calculates various measures of deprivation on data you have.
Data cannot be automatically downloaded with this option, and the
output options are more limited. See Details under dep_get_index
for
more information. For information about structuring your data prior to
using this function, see Details below.
dep_calc_index(.data, geography, index, year, survey = "acs5",
return_percentiles = FALSE, keep_subscales = FALSE, keep_components = FALSE,
output = "wide")
A data frame, tibble, or sf
object that contains all
of the columns needed to calculate your selected deprivation measure(s).
See Details below.
A character scalar; one of "county"
, "zcta3"
,
"zcta5"
, or "tract"
A character scalar or vector listing deprivation measures
to return. These include the area deprivation index ("adi"
),
the gini coefficient ("gini"
), two versions of the neighborhood
deprivation index by Messer ("ndi_m"
) and Powell and Wiley
("ndi_pw"
), and four versions of the social vulnerability
index ("svi10"
, "svi14"
, "svi20"
, and "svi20s"
).
See Details.
A numeric scalar between 2010 and 2022.
A character scalar representing the Census product. It can
be any American Community Survey product (either "acs1"
,
"acs3"
, or "acs5"
). Note that "acs3"
was
discontinued after 2013.
A logical scalar; if TRUE
, scales
(and their subscales) will be returned as percentiles instead of in
raw scores. If FALSE
(default), raw scores will be returned. Note
that SVI is returned as a percentile regardless of what
return_percentiles
is set to.
A logical scalar; if FALSE
(default), only the
full ADI and/or SVI scores (depending on what is passed to the index
argument) will be returned. If TRUE
and "svi"
is listed for
the index
argument, the four SVI "themes" (see Details) will be
returned along with the full SVI score. Similarly, if "adi"
is
listed for the index
argument, the three ADI subscales (see Details)
will be returned.
A logical scalar; if FALSE
(default), none of
the components used to calculate the deprivation measures will be returned.
If TRUE
, all of the demographic variables used to calculate ADI
and/or SVI will be returned.
A character scalar; if "wide"
(default), a tibble
will be returned with row per jurisdiction where individual measures of
deprivation stored in columns. If "tidy"
, a tibble will be returned
with one row for each combination of jurisdiction and deprivation measure.
A tibble object containing the requested deprivation measures.
Input data must be "wide" formatted and should have the following columns:
"GEOID"
The appropriately formatted GEOID values for the geography given in the function. This is required.
"YEAR"
The year that corresponds to the demographic data. For five-year ACS data, this should correspond to the final year in the period (e.x. 2021 for the 2017-2021 ACS). This is required only if deprivation scores are being generated for more than one year.
All of the necessary columns required for the deprivation scores and years given (since the input measures vary between scores and over time for individual scores.)
## load sample data
ndi_m <- dep_sample_data(index = "ndi_m")
## calculate NDI with sample data
ndi_m <- dep_calc_index(ndi_m, geography = "county", index = "ndi_m", year = 2022,
return_percentiles = TRUE)
#> Warning: The proportion of variance explained by PC1 is less than 0.50.