download_redcap_records: Download New Interview Tool Data

View source: R/download_redcap_records.R

download_redcap_recordsR Documentation

Download New Interview Tool Data

Description

download_redcap_records() downloads records from a REDcap project

Usage

download_redcap_records(
  api_token,
  dir,
  file,
  headers = c("raw", "label"),
  values = c("raw", "label"),
  filter = NULL,
  force = FALSE
)

Arguments

api_token

character. API token/key for accessing the project programmatically. Best practice is to set as an environment variable and retrieve using Sys.getenv("token_environment_variable"). See env_vars for more information.

dir

character. Directory to save data; this should usually remain unchanged.

file

character. File name for data; this should usually remain unchanged. The resulting file will always have a "csv" extension; if you pass a file name without a "csv" extension, the function will replace it with a warning.

headers

"raw" or "label". Should column names ("headers") be exported as the raw variable names ("raw", the default) or the label shown in the UI ("label")?

values

"raw" or "label". Should values in multiple-choice and checkbox fields be exported as the raw coded value ("raw", the default) or the label for the coded value ("label")?

filter

character. REDcap filtering logic to apply prior to download. This must be in the REDcap logic syntax.

force

Should the download overwrite an existing file, if one exists? The default is FALSE, which errors if an existing file is found.

Value

The path to the data as an fs_path character vector


jesse-smith/coviData documentation built on Jan. 14, 2023, 11:08 a.m.