fill_vars | R Documentation |
A function to carryforward election-specific variables in V-Dem provided no interruption in the electoral regime (v2x_elecreg).
fill_vars(fill_na = FALSE)
fill_na |
Whether the NA values for breaks in the electoral regime should be filled with zeros. The default = FALSE. |
Some variables in the V-Dem dataset are coded at the election-year only. However, users may wish to include these in country-year analyses. This function fills the election specific indicators for subsequent years, provided that there has not been any interruption in the electoral regime, as defined by v2x_elecreg. More specifically, it carries forward values between elections for all variables that are election-specific, unless v2x_elecreg becomes zero.
The indicators being filled include: "v2elmulpar", "v2elpeace", "v2elrgstry", "v2elvotbuy", "v2elirreg", "v2elintim", "v2elboycot", "v2elfrcamp", "v2elpdcamp", "v2elfrfair", "v2elaccept", "v2elasmoff".
Also filled are all _osp, _ord, _mean, _nr, _codelow, and _codehigh versions of these indicators.
When v2x_elecreg becomes zero, the function by default leaves election-specific variables as missing (NA). Logically, one could infer that the lowest possible values are valid in such cases. Therefore, users can optionally specify that the election-specific variables with the suffix _osp, _ord, and _mean are recoded as zero when there is no electoral regime by setting fill_na=TRUE.
This option does not currently apply to estimates from the measurement model because these variables follow an approximate z-score distribution without an absolute minimum. Future iterations of this function may provide additonal options for filling these values with some theoretical minimum.
A data frame with the most recent V-Dem dataset from the vdemdata package where election variables have been filled.
#Don't run
# Fill vars for all election-specific variables in the most recent vdem dataset
# vdem_filled <- fill_vars()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.