get_preview: Create a preview dataframe object of a CES survey.

Description Usage Arguments Details Value See Also Examples

View source: R/getpreview.R

Description

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

Usage

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

Arguments

srvy

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

obs

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.

pos

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

Details

Datasets

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.

Value

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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
# print out CES call codes
get_cescodes()

# call the 1993 CES dataset
get_ces("ces1993")

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

## End(Not run)

cesR documentation built on Nov. 24, 2021, 1:10 a.m.