Learn R Programming

ces (version 1.0.2)

create_codebook: Create a Codebook for Canadian Election Study Dataset

Description

This function generates a comprehensive codebook for a CES dataset, including variable names, question labels, and response options.

Usage

create_codebook(data, include_values = TRUE, format = "tibble")

Value

A tibble or data.frame containing the codebook with columns for variable name, question label, and response options.

Arguments

data

A CES dataset, typically retrieved using get_ces().

include_values

Logical indicating whether to include response values in addition to labels. Default is TRUE.

format

A character string indicating the format to return the codebook in. Default is "tibble". Options include "tibble" or "data.frame".

Examples

Run this code
# \donttest{
# Get the 2019 CES data
ces_2019 <- get_ces("2019")

# Create a codebook
codebook <- create_codebook(ces_2019)

# View the first few entries
head(codebook)

# Create a codebook without values
codebook_simple <- create_codebook(ces_2019, include_values = FALSE)
# }

Run the code above in your browser using DataLab