Learn R Programming

redcapAPI (version 2.7.4)

exportReports: Export Reports from a REDCap Database

Description

Exports reports from a REDCap Database and formats data if requested

Usage

exportReports(
  rcon,
  report_id,
  factors = TRUE,
  labels = TRUE,
  dates = TRUE,
  drop = NULL,
  checkboxLabels = FALSE,
  ...
)

# S3 method for redcapApiConnection exportReports( rcon, report_id, factors = TRUE, labels = TRUE, dates = TRUE, drop = NULL, checkboxLabels = FALSE, ..., error_handling = getOption("redcap_error_handling"), config = list(), api_param = list() )

Arguments

rcon

A REDCap connection object as created by redcapConnection.

report_id

Integer. Gives the report id of the desired report. This is located on the Report Builder page of the user interface on REDCap.

factors

Logical. Determines if categorical data from the database is returned as numeric codes or labelled factors.

labels

Logical. Determines if the variable labels are applied to the data frame.

dates

Logical. Determines if date variables are converted to POSIXct format during the download.

drop

An optional character vector of REDCap variable names to remove from the dataset; defaults to NULL. E.g., drop=c("date_dmy", "treatment") It is OK for drop to contain variables not present; these names are ignored.

checkboxLabels

Logical. Determines the format of labels in checkbox variables. If FALSE labels are applies as "Unchecked"/"Checked". If TRUE, they are applied as ""/"[field_labe]" where [field_label] is the label assigned to the level in the data dictionary. This option is only available after REDCap version 6.0.

...

Additional arguments to be passed between methods.

error_handling

An option for how to handle errors returned by the API. see redcap_error

config

list Additional configuration parameters to pass to POST. These are appended to any parameters in rcon$config.

api_param

list Additional API parameters to pass into the body of the API call. This provides users to execute calls with options that may not otherwise be supported by redcapAPI.

REDCap API Documentation (6.5.0)

This function allows you to export the data set of a report created on a project's "Data Exports, Reports, and Stats" page.

Note about export rights (6.0.0+): Please be aware that Data Export user rights will be applied to this API request. For example, if you have "No Access" data export rights in the project, then the API report export will fail and return an error. And if you have "De-Identified" or "Remove all tagged Identifier fields" data export rights, then some data fields *might* be removed and filtered out of the data set returned from the API. To make sure that no data is unnecessarily filtered out of your API request, you should have "Full Data Set" export rights in the project.

REDCap Version

6.0.0+

Known REDCap Limitations

None

Author

Benjamin Nutter

Details

A record of exports through the API is recorded in the Logging section of the project.

Reports are exported based on their id number, which can be looked up in the Reports page of a project