Title: | A Functional Tool for 'CongressData' |
---|---|
Description: | A tool that imports, subsets, and exports the 'CongressData' dataset. 'CongressData' contains approximately 800 variables concerning all US congressional districts with data back to 1789. The dataset tracks district characteristics, members of Congress, and the political behavior of those members. Users with only a basic understanding of R can subset this data across multiple dimensions, export their search results, identify the citations associated with their searches, and more. |
Authors: | Caleb Lucas [aut, cre], Ben Yoel [ctb] |
Maintainer: | Caleb Lucas <[email protected]> |
License: | GPL-3 |
Version: | 1.5.4 |
Built: | 2024-11-03 04:50:47 UTC |
Source: | https://github.com/cran/CongressData |
get_cong_data
loads either a full or subsetted version of the full
CongressData dataset into the R environment as a dataframe.
get_cong_data(states = NULL, related_to = "", years = NULL)
get_cong_data(states = NULL, related_to = "", years = NULL)
states |
Default is NULL. If left blank, returns all states. Takes a string or vector of strings of state names. |
related_to |
Default is "". Provide a string to search a variable's name, short/long descriptions from the codebook, and its citation for non-exact matches o f a search term. For example, searching 'tax' will return variables with words like 'taxes' and 'taxable' in any of those columns. |
years |
Default is NULL. If left blank, returns all years Input can be
a single year (e.g. 2001) or a two year that represent the first and last
that you want in the outputted dataframe (such as |
An object of type tibble containing CongressData. The tibble has columns corresponding
to variables in the dataset, and rows corresponding to observations that match
the filtering criteria specified by the states
, related_to
, and years
parameters.
get_congress_version
prints the current version of CongressData available through the package. It takes no arguments.
get_congress_version()
get_congress_version()
No return value, called for side effects.
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.
get_var_info(var_names = NULL, related_to = NULL)
get_var_info(var_names = NULL, related_to = NULL)
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. |
Specifying no arguments returns all the information for all the variables in the CongressData dataset.
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.
# 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"))
# 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"))