View source: R/get_cspp_data.R
get_cspp_data | R Documentation |
get_cspp_data
loads either a full or subsetted version of the full
CSPP dataset into the R environment as a dataframe.
get_cspp_data( vars = NULL, var_category = NULL, states = NULL, years = NULL, core = FALSE, output = NULL, path = "" )
vars |
Default is NULL. If left blank, returns all variables within the
dataset. Takes a string or vector of strings. See
|
var_category |
Default is NA. If left blank, returns all datasets. Takes a string or vector of strings. Options are one of, or a combination of: "demographics", "economic-fiscal", "government", "elections", "policy_ideology", "criminal justice", "education", "healthcare", "welfare", "rights", "environment", "drug-alcohol", "gun control", "labor", "transportation", "misc. regulation" |
states |
Default is NULL. If left blank, returns all states. Takes a
string or vector of strings of state abbreviations. Use |
years |
Default is NULL. If left blank, returns all years. Coverage
begins at 1900 and runs to 2019. However, coverage depends on the specific
variable – see Input can be a vector of years (or a singular year), such as c(2000, 2001, 2002, 2012) or seq(2000, 2012). |
core |
Default is FALSE. If TRUE, merge the core CSPP data (approximately 70 common and important variables) with the search result. |
output |
Default is NULL. One of "csv", "dta", "rdata". Optional parameter for writing the resulting dataframe to a file. |
path |
The directory to write the file to. Default is blank, so writes to
working directory. Exclude final slash: e.g., |
get_var_info
, get_cites
, generate_map
## returns full dataset data <- get_cspp_data() ## use variable names from get_var_info data <- get_cspp_data(vars = get_var_info(var_names="pctpop")$variable) ## return subsets # note: this returns the specific variables listed as well as those in the # var_category argument data <- get_cspp_data(vars = c("sess_length", "hou_majority", "term_length"), var_category = "demographics", states = c("NC", "VA", "GA"), years = seq(1995, 2004))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.