get_ces {cesR}R Documentation

Create a dataframe object for a CES survey.

Description

get_ces() creates a dataframe object for a requested Canadian Election Study survey using an associated survey code to call and download the survey dataset. On creation of the data object, prints out the associated citation for use with the requested dataset and a link to the original location of the data file.

Usage

get_ces(srvy, pos = 1)

Arguments

srvy

A CES survey code call. See Survey Code Calls below. srvy value must be a character string.

pos

Environment assignment. Defaults to 1, which is an assignment to the global environment.

Details

Datasets

Datasets are loaded using .dta, .sav, or .tab file types. See File Types below for a list of included CES datasets and their file type. To quickly convert a dataset's values to factor type use labelled::to_factor() on the dataset.

Survey Code Calls

File Types

Incorrect/Repeated Code Calls

Incorrect (a non-existent survey code) will stop the function process and return an associated error message. Repeated code calls will load in the raw version of the requested table.

Extra Notes

Due to the naming of the columns in the 1965 and 1968 datasets it is recommended to download the associated codebook for the requested dataset.

Value

The called srvy at the designated environment position pos. Default environment position is set to be the global environment.

See Also

get_cescodes() function help.

Examples

## Not run: 
# call the 2019 CES online survey
get_ces("ces2019_web")

# convert variables to factor
labelled::to_factor(ces2019_web)

# preview dataset
head(ces2019_web)

## End(Not run)

[Package cesR version 0.1.0 Index]