download_ces_dataset {ces}R Documentation

Download a Canadian Election Study Dataset

Description

This function downloads a single Canadian Election Study dataset for a specified year. The dataset is saved with a standardized filename in the format of ⁠ces_<year>.<format>⁠, where the format extension corresponds to the original dataset format (e.g., .sav for SPSS, .dta for Stata).

Usage

download_ces_dataset(year, path = NULL, overwrite = FALSE, verbose = TRUE)

Arguments

year

A character string indicating the year of the CES data to download. Available years include "1965", "1968", "1974-1980", "1984", "1988", "1993", "1997", "2000", "2004", "2006", "2008", "2011", "2015", "2019", "2021".

path

A character string indicating the directory where the dataset should be saved. If NULL (default), the dataset will be saved to the Downloads directory if available, otherwise to a temporary directory.

overwrite

Logical indicating whether to overwrite existing files. Default is FALSE.

verbose

Logical indicating whether to display detailed progress messages during download. Default is TRUE.

Value

Invisibly returns the file path of the downloaded dataset.

Examples


# Download the 2019 CES dataset to a temporary directory
download_ces_dataset("2019", path = tempdir())

# Download to a specific directory
download_ces_dataset("2015", path = tempdir())

# Overwrite existing file
download_ces_dataset("2021", path = tempdir(), overwrite = TRUE)



[Package ces version 0.1.0 Index]