Merges state- and year-level structural indices derived from publicly available data into your dataset. You can find all available indices in stigmaRdata.
Arguments
- df
A data frame containing your data.
- state
Character string. Name of the column in
dfcontaining two-letter state abbreviations (e.g., "IL", "CA").- index
Character vector. One or more composite indices to merge in. The set of valid indices is determined automatically from the columns of the bundled
compositedataset (every column exceptstateandyear). Examples include:"iat_sex_implicit": IAT D-score (implicit pro-straight bias; higher = more stigma)"iat_sex_explicit_pol": Average of policy opposition items (marriage rights, relations legality, adoption, service refusal, transgender bathroom)
See
names(stigmaR::composite)for the full, current list.- year
Character vector. Years to merge in (e.g.,
c("2016", "2017")). Each year x index combination becomes one new column namedYYYY_iat_sex_implicit(as an exeample).
Value
The input data frame with new columns named YYYY_iat_sex_implicit
containing matched state-level stigma scores for each requested year
and index.