get_var_info: Get information regarding CongressData variables

View source: R/get_var_info.R

get_var_infoR Documentation

Get information regarding CongressData variables

Description

get_var_info retrieves information regarding variables in the CongressData dataset. The information available includes: the years each variable is observed in the data; a short and long description of each variable; and the source and citation/s for each variable. Citations are available in both bibtex and plain text.

Usage

get_var_info(var_names = NULL, related_to = NULL)

Arguments

var_names

Default is NULL. Takes a character string. If left blank the function does not subset by variable name. Note that this searches variable names, it does not subset by the specific string you provide. So "over65" will return a variable called 'over65' along with another called 'percent_over65'.

related_to

Default is NULL. Takes a character string. If the user supplies a character string, the function searches the other relevant fields (variable name, short/long description, and source) for string matches. Not case sensitive.

Details

Specifying no arguments returns all the information for all the variables in the CongressData dataset.

Value

A tibble with information about variables in the CongressData dataset. The tibble contains the following columns:

  • variable: The name of the variable.

  • years: The years the variable is observed.

  • short_desc: A short description of the variable.

  • long_desc: A long description of the variable.

  • source: The source of the data.

  • citation: The citation for the data, available in bibtex and plain text.

The tibble is filtered based on the provided var_names and related_to parameters.

Examples


# returns all variable information
get_var_info()

# match var names that contain "over65" - note this returns multiple variables
get_var_info(var_names = "over65")

get_var_info(related_to = c("pop","femal"))


CongressData documentation built on June 19, 2025, 5:08 p.m.