Skip to contents

Exports of large databases may fail using the standard export methods implemented in redcap_export_tbl and redcap_export_byform. To remedy this, the redcap_export_batch function exports data in smaller chunks (of 1000 records by default)

Usage

redcap_export_batch(
  token,
  url,
  batchsize = 1000,
  meta = NULL,
  byform = FALSE,
  remove_empty = TRUE,
  ...
)

Arguments

token

REDcap API token

url

address of the API

batchsize

number of records per batch

meta

metadata from redcap_export_meta (will be downloaded if not provided)

byform

logical. Download data by form (see redcap_export_byform)

remove_empty

when using byform: should empty rows be removed from the dataset (REDCap automatically creates all forms for an event when any form in the event is created)

...

other options passed to [redcap_export_tbl]

Value

depending on byform, either a list of dataframes or a single dataframe

Examples

# token <- "some_really_long_string_provided_by_REDCap"
# as a single dataframe
# redcap_export_batch(token, "https://www.some_redcap_url.com/api/")
# as a list of dataframes (forms)
# redcap_export_batch(token, "https://www.some_redcap_url.com/api/", byform = TRUE)