download_all_ces_datasets {ces}R Documentation

Download All Canadian Election Study Datasets

Description

This function downloads all available Canadian Election Study datasets to a specified directory. Each 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_all_ces_datasets(
  path = NULL,
  years = NULL,
  overwrite = FALSE,
  verbose = TRUE
)

Arguments

path

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

years

Optional character vector specifying which years to download. If NULL (default), all available years will be downloaded.

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 a character vector with the file paths of the downloaded datasets.

Examples


# Download all CES datasets to a temporary directory
download_all_ces_datasets(path = tempdir())

# Download only specific years
download_all_ces_datasets(years = c("2015", "2019", "2021"), path = tempdir())

# Download to a temporary directory with overwrite
download_all_ces_datasets(path = tempdir(), overwrite = TRUE)



[Package ces version 0.1.0 Index]