knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(redcaptools)
REDCap has a long list of API endpoints (types of information) that can be extracted. Here we list the most important ones (in our opinion), and give an indication of how to access them via redcaptools
.
redcap_export_tbl
is the real workhorse of redcaptools
. It is the primary interface to the API. Other export functions all wrap this in some form.
The most important is arguably the record
endpoint, which allows you to download the actual data.
redcap_export_tbl(token, url, "record")
Without the data dictionary, it's often difficult to tell what a variable is.
redcap_export_tbl(token, url, "metadata")
This is one of the three pieces of metadata downloaded by default by the redcap_export_meta
function.
redcap_export_meta(token, url)$metadata
The data dictionary is also really important for the functions which format and label variables (e.g. redcap_prep
, singlechoice_ops
, singlechoice_factor
and co)
The list of eCRFs (known as instruments in REDCap). This provides a link between the data dictionary and the instrument labels as seen in REDCap.
redcap_export_tbl(token, url, "instrument")
The list of events (visits)
redcap_export_tbl(token, url, "event")
This is one of the three pieces of metadata downloaded by the redcap_export_meta
function.
redcap_export_meta(token, url)$event
This endpoint lists which forms are available in which events/visits.
redcap_export_tbl(token, url, "formEventMapping")
This is one of the three pieces of metadata downloaded by the redcap_export_meta
function.
redcap_export_meta(token, url)$formEventMapping
This is of use when repeated forms and/or events are used.
redcap_export_tbl(token, url, "repeatingFormsEvents")
Arms allow different groups of participants (records) to have different visit structures. In the export, they are visible in the redcap_event_name
variable as e.g. form_name_arm_1
. The arm
API endpoint allows one to retrieve the labels for the arms.
redcap_export_tbl(token, url, "arm")
This endpoint lists the variable names as they are exported from REDCap. It matches the data dictionary, except for the case of multiple choice variables which are exported as x1, x2, etc.
redcap_export_tbl(token, url, "exportFieldNames")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.