get_preview {cesR}R Documentation

Create a preview dataframe object of a CES survey.


get_preview() creates a truncated dataframe for a requested Canadian Election Study survey using an associated code to call and download the survey dataset.


get_preview(srvy, obs = 6, pos = 1)



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


A numerical value that determines the number of observations returned. If a value for obs is not given, then default value is 6 observations. Variable must be given as a numerical value.


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



Datasets are loaded using either .dta or .sav file types and converted to factor type using the to_factor() function from the labelled package.

Survey Code Calls

get_preview() uses the same survey code calls as the get_ces() function. These survey code calls are listed below.

Incorrect/Repeated Code Calls

Incorrect (a non-existent survey code) will stop the function process and return associated error messages. Repeated code calls will load in an unaltered 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.


The truncated version of the requested survey dataset srvy with the set number of observations obs to the designated environment pos.

See Also

get_ces() function help. get_cescodes() function help.


## Not run: 
# print out CES call codes

# call the 1993 CES dataset

# preview the first 10 observations of the dataset
get_preview("ces1993", 10)

## End(Not run)

[Package cesR version 0.1.0 Index]