extract_vdem: Extracts parts of the V-Dem dataset by section number, name...

Description Usage Arguments Value Examples

View source: R/extractor_functions.R

Description

Extracts variables in the V-Dem dataset (version 11), according to the section number in the codebook or a regular expression pattern matching the name or the label.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
extract_vdem(
  section_number = NULL,
  name_pattern = NULL,
  label_pattern = NULL,
  include_uncertainty = TRUE,
  include_sd = FALSE,
  include_osp = FALSE,
  include_ord = FALSE,
  include_nr = FALSE,
  include_external = FALSE
)

Arguments

section_number

A section number (or vector of section numbers) in the V-dem codebook. Must be an integer or an integer vector (e.g., 1:2, or 28).

name_pattern

A character pattern, interpreted as a regular expression, to search over the V-dem variable names, e.g., "v2x" extracts all variables including the string "v2x" in their names.

label_pattern

A character pattern, interpreted as a regular expression, to search over the V-dem labels, e.g., "corrupt" extracts all variables that mention "corrupt" in their label.

include_uncertainty

Whether to return the uncertainty measurements for the selected variables (codelow and codehigh suffixes). Default is TRUE.

include_sd

Whether to return the standard deviation for the selected variables (sd suffix). Default is FALSE.

include_osp

Whether to return variables available in the original scale (osp suffix, linearized original scale posterior prediction). Default is FALSE.

include_ord

Whether to return variables available in an ordinal scale (ord suffix, measurement model estimates of original scale value). Default is FALSE.

include_nr

Whether to return the number of coders for the variable (nr suffix). Default is FALSE.

include_external

Whether to return variables marked "external", i.e., coming from an external source rather than V-Dem (e_ prefix). Default is FALSE.

Value

A tibble with the V-Dem country identifiers, other state system identifiers, plus the desired variables.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Main democracy indexes
extract_vdem(section_number = 2)
# Mid-level indexes, no measures of uncertainty
extract_vdem(section_number = 3, include_uncertainty = FALSE)
# All indexes about corruption
extract_vdem(label_pattern = "corrupt")
# All indexes about elections, include external indexes
extract_vdem(label_pattern = "elect", include_external = TRUE)
# All civil liberties indexes, include original scale prediction
extract_vdem(name_pattern = "^v2cl", include_osp = TRUE)
# Combine section and label patterns
extract_vdem(section_number = 1, label_pattern = "elect", include_external = TRUE)

xmarquez/vdem documentation built on April 10, 2021, 8:31 a.m.