Learn R Programming

redcapAPI (version 2.7.4)

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, ...)

# S3 method for redcapApiConnection exportFieldNames( rcon, fields = character(0), ..., error_handling = getOption("redcap_error_handling"), config = list(), api_param = list() )

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].

Arguments

rcon

A REDCap connection object as generated by redcapConnection.

...

Arguments to be passed to other methods.

fields

character with maximum length of 1. Field name to be returned. By default, all fields are returned.

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

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.

Author

Stephen Lane

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/vubiostat/redcapAPI/wiki/REDCap-API-Parameters