Learn R Programming

redcapAPI (version 2.0)

exportFieldNames: Export the Export Field Names for a Project

Description

Retrieve a data frame giving the original (as defined in REDCap) field name, choice values (for checkboxes), and the export field name.

Usage

exportFieldNames(rcon, ...,
  error_handling = getOption("redcap_error_handling"))

# S3 method for redcapDbConnection exportFieldNames(rcon, fields = NULL, bundle = NULL, ..., error_handling = getOption("redcap_error_handling"))

# S3 method for redcapApiConnection exportFieldNames(rcon, fields = NULL, bundle = NULL, ..., error_handling = getOption("redcap_error_handling"))

Arguments

rcon

A REDCap connection object as generated by redcapConnection.

...

Arguments to be passed to other methods.

error_handling

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

fields

Field name to be returned. If NULL, all fields are returned.

bundle

A redcapProject object as created by redcapProjectInfo.

Value

A data frame containing three fields:

  • original_field_name The field name as recorded in the data dictionary

  • choice_value represents the raw coded value for a checkbox choice. For non-checkbox fields, this will always be NA.

  • export_field_name The field name specific to the field. For non-checkbox fields, this is the same as original_field_name. For checkbox fields, it is the field name appended with ___[choice_value].

REDCap API Documentation

This function returns a list of the export/import-specific version of field names for all fields (or for one field, if desired) in a project. This is mostly used for checkbox fields because during data exports and data imports, checkbox fields have a different variable name used than the exact one defined for them in the Online Designer and Data Dictionary, in which *each checkbox option* gets represented as its own export field name in the following format: field_name + triple underscore + converted coded value for the choice. For non-checkbox fields, the export field name will be exactly the same as the original field name. Note: The following field types will be automatically removed from the list returned by this method since they cannot be utilized during the data import process: "calc", "file", and "descriptive".

The list that is returned will contain the three following attributes for each field/choice: "original_field_name", "choice_value", and "export_field_name". The choice_value attribute represents the raw coded value for a checkbox choice. For non-checkbox fields, the choice_value attribute will always be blank/empty. The export_field_name attribute represents the export/import-specific version of that field name.

REDCap Version

6.5.0+ (perhaps earlier; need to confirm its introduction)

Known REDCap Limitations

In 6.5.0, it has been observed that "slider" fields are not returned.

Signature fields are also not included, but these are effectively the same as "file" fields. This isn't a true limitation, but is documented here just to avoid confusion.

References

Please refer to your institution's API documentation (https://YOUR_REDCAP_URL/redcap/api/help)

Additional details on API parameters are found on the package wiki at https://github.com/nutterb/redcapAPI/wiki/REDCap-API-Parameters