Extracts variables in the V-Dem dataset (version 11), by using a filter expression that is used to extract variable names from the V-Dem coddebook (vdem_codebook)

extract_vdem_filter(
  ...,
  include_uncertainty = TRUE,
  include_sd = FALSE,
  include_osp = FALSE,
  include_ord = FALSE,
  include_nr = FALSE,
  include_external = FALSE
)

Arguments

...

A sequence of filter expressions, separated by commas, suitable for use with dplyr::filter, operating on the column names of vdem_codebook. See examples.

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

# All in section 2 of the codebook except component indexes extract_vdem_filter(section == 2, !grepl("component index", label))
#> # A tibble: 27,192 x 93 #> vdem_country_name vdem_country_text~ vdem_country_id year extended_country_~ #> <chr> <chr> <dbl> <dbl> <chr> #> 1 Mexico MEX 3 1789 Mexico #> 2 Mexico MEX 3 1790 Mexico #> 3 Mexico MEX 3 1791 Mexico #> 4 Mexico MEX 3 1792 Mexico #> 5 Mexico MEX 3 1793 Mexico #> 6 Mexico MEX 3 1794 Mexico #> 7 Mexico MEX 3 1795 Mexico #> 8 Mexico MEX 3 1796 Mexico #> 9 Mexico MEX 3 1797 Mexico #> 10 Mexico MEX 3 1798 Mexico #> # ... with 27,182 more rows, and 88 more variables: GWn <dbl>, #> # historical_date <date>, project <dbl>, historical <dbl>, histname <chr>, #> # codingstart <dbl>, codingend <dbl>, codingstart_contemp <dbl>, #> # codingend_contemp <dbl>, codingstart_hist <dbl>, codingend_hist <dbl>, #> # gapstart1 <dbl>, gapstart2 <dbl>, gapstart3 <dbl>, gapend1 <dbl>, #> # gapend2 <dbl>, gapend3 <dbl>, gap_index <dbl>, vdem_cown <dbl>, #> # v2x_polyarchy <dbl>, v2x_libdem <dbl>, v2x_partipdem <dbl>, #> # v2x_delibdem <dbl>, v2x_egaldem <dbl>, v2x_api <dbl>, v2x_mpi <dbl>, #> # v2x_freexp_altinf <dbl>, v2x_frassoc_thick <dbl>, v2x_suffr <dbl>, #> # v2xel_frefair <dbl>, v2x_elecoff <dbl>, v2xcl_rol <dbl>, v2x_jucon <dbl>, #> # v2xlg_legcon <dbl>, v2x_cspart <dbl>, v2xdd_dd <dbl>, v2xel_locelec <dbl>, #> # v2xel_regelec <dbl>, v2xeg_eqprotec <dbl>, v2xeg_eqaccess <dbl>, #> # v2xeg_eqdr <dbl>, v2x_polyarchy_codelow <dbl>, v2x_libdem_codelow <dbl>, #> # v2x_partipdem_codelow <dbl>, v2x_delibdem_codelow <dbl>, #> # v2x_egaldem_codelow <dbl>, v2x_api_codelow <dbl>, v2x_mpi_codelow <dbl>, #> # v2x_freexp_altinf_codelow <dbl>, v2x_frassoc_thick_codelow <dbl>, #> # v2xel_frefair_codelow <dbl>, v2xcl_rol_codelow <dbl>, #> # v2x_jucon_codelow <dbl>, v2xlg_legcon_codelow <dbl>, #> # v2x_cspart_codelow <dbl>, v2xel_locelec_codelow <dbl>, #> # v2xel_regelec_codelow <dbl>, v2xeg_eqprotec_codelow <dbl>, #> # v2xeg_eqaccess_codelow <dbl>, v2xeg_eqdr_codelow <dbl>, #> # v2x_polyarchy_codehigh <dbl>, v2x_libdem_codehigh <dbl>, #> # v2x_partipdem_codehigh <dbl>, v2x_delibdem_codehigh <dbl>, #> # v2x_egaldem_codehigh <dbl>, v2x_api_codehigh <dbl>, v2x_mpi_codehigh <dbl>, #> # v2x_freexp_altinf_codehigh <dbl>, v2x_frassoc_thick_codehigh <dbl>, #> # v2xel_frefair_codehigh <dbl>, v2xcl_rol_codehigh <dbl>, #> # v2x_jucon_codehigh <dbl>, v2xlg_legcon_codehigh <dbl>, #> # v2x_cspart_codehigh <dbl>, v2xel_locelec_codehigh <dbl>, #> # v2xel_regelec_codehigh <dbl>, v2xeg_eqprotec_codehigh <dbl>, #> # v2xeg_eqaccess_codehigh <dbl>, v2xeg_eqdr_codehigh <dbl>, #> # GW_startdate <date>, GW_enddate <date>, GWc <chr>, extended_region <chr>, #> # extended_continent <chr>, microstate <lgl>, lat <dbl>, lon <dbl>, #> # in_GW_system <lgl>
# All variables inclued in release 2 of the dataset extract_vdem_filter(grepl("2(,|$)|1-11", data_release))
#> # A tibble: 27,192 x 688 #> vdem_country_name vdem_country_text~ vdem_country_id year extended_country_~ #> <chr> <chr> <dbl> <dbl> <chr> #> 1 Mexico MEX 3 1789 Mexico #> 2 Mexico MEX 3 1790 Mexico #> 3 Mexico MEX 3 1791 Mexico #> 4 Mexico MEX 3 1792 Mexico #> 5 Mexico MEX 3 1793 Mexico #> 6 Mexico MEX 3 1794 Mexico #> 7 Mexico MEX 3 1795 Mexico #> 8 Mexico MEX 3 1796 Mexico #> 9 Mexico MEX 3 1797 Mexico #> 10 Mexico MEX 3 1798 Mexico #> # ... with 27,182 more rows, and 683 more variables: GWn <dbl>, #> # historical_date <date>, project <dbl>, historical <dbl>, histname <chr>, #> # codingstart <dbl>, codingend <dbl>, codingstart_contemp <dbl>, #> # codingend_contemp <dbl>, codingstart_hist <dbl>, codingend_hist <dbl>, #> # gapstart1 <dbl>, gapstart2 <dbl>, gapstart3 <dbl>, gapend1 <dbl>, #> # gapend2 <dbl>, gapend3 <dbl>, gap_index <dbl>, vdem_cown <dbl>, #> # v2x_polyarchy <dbl>, v2x_libdem <dbl>, v2x_partipdem <dbl>, #> # v2x_delibdem <dbl>, v2x_egaldem <dbl>, v2x_frassoc_thick <dbl>, #> # v2x_suffr <dbl>, v2xel_frefair <dbl>, v2x_elecoff <dbl>, v2x_liberal <dbl>, #> # v2xcl_rol <dbl>, v2x_jucon <dbl>, v2xlg_legcon <dbl>, v2x_partip <dbl>, #> # v2x_cspart <dbl>, v2xdd_dd <dbl>, v2xel_locelec <dbl>, v2xel_regelec <dbl>, #> # v2xdl_delib <dbl>, v2x_egal <dbl>, v2elage <dbl>, v2elcomvot <dbl>, #> # v2elgvsuflvl <dbl>, v2elsuffrage <dbl>, v2eldonate <dbl>, v2elpubfin <dbl>, #> # v2elembaut <dbl>, v2elembcap <dbl>, v2elmulpar <dbl>, v2elrgstry <dbl>, #> # v2elvotbuy <dbl>, v2elirreg <dbl>, v2elintim <dbl>, v2elpeace <dbl>, #> # v2elboycot <dbl>, v2elfrcamp <dbl>, v2elpdcamp <dbl>, v2elpaidig <dbl>, #> # v2elfrfair <dbl>, v2eldommon <dbl>, v2elintmon <dbl>, v2elmonden <dbl>, #> # v2elrstrct <dbl>, v2elaccept <dbl>, v2elasmoff <dbl>, v2elvaptrn <dbl>, #> # v2eltvrexo <dbl>, v2elvotlrg <dbl>, v2elvotsml <dbl>, v2elloseat <dbl>, #> # v2ellostlg <dbl>, v2ellostsl <dbl>, v2ellostsm <dbl>, v2ellostss <dbl>, #> # v2ellovtlg <dbl>, v2ellovtsm <dbl>, v2elthresh <dbl>, v2eltvrig <dbl>, #> # v2elrgpwr <dbl>, v2ellocpwr <dbl>, v2elsnlsff <dbl>, v2psbars <dbl>, #> # v2psparban <dbl>, v2psoppaut <dbl>, v2psorgs <dbl>, v2psprbrch <dbl>, #> # v2psprlnks <dbl>, v2psplats <dbl>, v2pscnslnl <dbl>, v2pscohesv <dbl>, #> # v2pscomprg <dbl>, v2psnatpar <dbl>, v2pssunpar <dbl>, v2ddlexci <dbl>, #> # v2ddsignci <dbl>, v2ddsigpci <dbl>, v2ddsigdci <dbl>, v2ddsiglci <dbl>, #> # v2ddpartci <dbl>, v2ddapprci <dbl>, v2ddspmci <dbl>, ...