Learn R Programming

REDCapTidieR

The REDCapTidieR package provides an elegant way to import data from a REDCap project into an R environment. It builds upon the REDCapR package to query the REDCap API and then transforms the returned data into a set of tidy tibbles.

REDCapTidieR is especially useful for dealing with complex REDCap projects that are longitudinal or include repeating instruments or both.

Installation

The release version can be installed from CRAN.

install.packages("REDCapTidieR")

You can install the development version of REDCapTidieR from GitHub:

devtools::install_github("CHOP-CGTInformatics/REDCapTidieR")

Usage

Use read_redcap() together with bind_tibbles() to import data from all instruments into your environment.

REDCapTidieR supports labelled data using the labelled package, and it can generate statistical summaries using the skimr package.

Read the Getting Started vignette to learn more.

In addition, you can easily create collaborator-friendly Excel files using the write_redcap_xlsx() function:

redcap_uri <- "https://my.institution.edu/redcap/api/"
token <- "123456789ABCDEF123456789ABCDEF04"

my_redcap_data <- read_redcap(redcap_uri, token)
write_redcap_xlsx(my_redcap_data, file = "my_redcap_data.xlsx")

To learn more about how to work with and customize the output, read the Exporting to Excel vignette.

Collaboration

We invite you to give feedback and collaborate with us! If you are familiar with GitHub and R packages, please feel free to submit a pull request. Please do let us know if REDCapTidieR fails for whatever reason with your database and submit a bug report by creating a GitHub issue.

Please note that this project is released with a Contributor Code of Conduct. By participating you agree to abide by its terms.

We’d like to thank the following folks for their advice and code contributions: Will Beasley and Paul Wildenhain.

Funding

This package was developed by the Children’s Hospital of Philadelphia Cell and Gene Therapy Informatics Team to support the needs of the Cellular Therapy and Transplant Section. The development was funded using the following sources:

  • Stephan Kadauke Start-up funds. Stephan Kadauke, PI, CHOP, 2018-2024

  • CHOP-based GMP cell manufacturing (MFG) for CAR T clinical trials. Stephan Grupp, PI; Stephan Kadauke, co-PI, CHOP, 2021-2023

Copy Link

Version

Install

install.packages('REDCapTidieR')

Monthly Downloads

405

Version

1.2.3

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Richard Hanna

Last Published

June 6th, 2025

Functions in REDCapTidieR (1.2.3)

convert_checkbox_vals

Convert a new checkbox column's values
check_fields_are_checkboxes

Check fields are of checkbox field type
bind_tibbles

Extract data tibbles from a REDCapTidieR supertibble and bind them to an environment
get_mixed_structure_fields

Get Mixed Structure Instrument List
extract_tibble

Extract a single data tibble from a REDCapTidieR supertibble
extract_tibbles

Extract data tibbles from a REDCapTidieR supertibble into a list
distill_nonrepeat_table

Extract non-repeat tables from non-longitudinal REDCap databases
multi_choice_to_labels

Update multiple choice fields with label data
calc_metadata_stats

Utility function to calculate summary for each tibble in a supertibble
get_metadata_spec

Get metadata specification table
check_redcap_populated

Check that a supplied REDCap database is populated
db_has_repeat_forms

Check whether a REDCap database has repeat forms
read_redcap

Import a REDCap database into a tidy supertibble
convert_mixed_instrument

Convert Mixed Structure Instruments to Repeating Instruments
extract_metadata_tibble

Extract a specific metadata tibble from a supertibble
checkmate

Check an argument with checkmate
create_repeat_instance_vars

Utility function to convert redcap repeat instance columns into appropriate form and event columns
distill_nonrepeat_table_long

Extract non-repeat tables from longitudinal REDCap databases
make_skimr_labels

Make skimr labels from default skimr outputs
check_parsed_labels

Check that parsed labels are not duplicated
check_user_rights

Check for possible API user privilege issues
remove_empty_rows

Remove rows with empty data
check_req_labelled_metadata_fields

Check that all metadata tibbles within a supertibble contain field_name and field_label columns
format-helpers

Format REDCap variable labels
replace_true

Replace checkbox TRUEs with raw_or_label values
check_fields_exist

Check fields exist for checkbox combination
write_redcap_xlsx

Write Supertibbles to XLSX
make_labelled

Apply variable labels to a REDCapTidieR supertibble
check_labelled

Check if labelled
skim_data

Apply applicable skimmers to data
link_arms

Link longitudinal REDCap instruments with their events/arms
strip_html_field_embedding

Remove html tags and field embedding logic from a string
combine_checkboxes

Combine Checkbox Fields into a Single Column
safe_set_variable_labels

Safely set variable labels
parse_logical_cols

Convert yesno, truefalse, and checkbox fields to logical
resolve_formatter

Convert user input into label formatting function
parse_labels

Parse labels from REDCap metadata into usable formats
release_questions

Additional release questions
clean_redcap_long

Extract longitudinal REDCap databases into tidy tibbles
check_metadata_fields_exist

Check metadata fields exist for checkbox combination
combine_and_repair_tbls

Combine checkbox fields with respect to repaired outputs
vec_ptype_abbr.redcap_supertbl

Vector type as a string
tbl_sum.redcap_supertbl

Provide a succinct summary of an object
clean_redcap

Extract non-longitudinal REDCap databases into tidy tibbles
update_field_names

Update metadata field names for checkbox handling
get_record_id_field

Utility function to extract the name of the project identifier field for a tibble of REDCap data
get_repeat_event_types

Add identification for repeat event types
get_fields_to_drop

Determine fields included in REDCapR::redcap_read_oneshot output that should be dropped from results of read_redcap
format_error_val

Format value for error message
superheroes_supertbl

Superheroes Data
supertbl_recode

Recode fields using supertbl metadata
try_redcapr

Make a REDCapR API call with custom error handling
distill_repeat_table

Extract repeat tables from non-longitudinal REDCap databases
distill_repeat_table_long

Extract repeat tables from longitudinal REDCap databases
invert_vec

Swap vector names for values
is_labelled

Determine if an object is labelled
update_dag_cols

Implement REDCapR DAG Data into Supertibble
update_data_col_names

Correctly label variables belonging to checkboxes with minus signs
REDCapTidieR-package

REDCapTidieR: Extract 'REDCap' Databases into Tidy 'Tibble's
add_skimr_metadata

Add skimr metrics to a supertibble's metadata
apply_labs_factor

Apply factor labels to a vector
check_equal_col_summaries

Check equal distinct values between two columns
add_event_mapping

Supplement a supertibble from a longitudinal database with information about the events associated with each instrument
add_partial_keys

Add partial key helper variables to dataframes
add_labelled_xlsx_features

Add labelled features to write_redcap_xlsx
add_metadata_sheet

Add the metadata sheet
add_supertbl_toc

Add the supertbl table of contents sheet
check_repeat_and_nonrepeat

Check for instruments that have both repeating and non-repeating structure
check_data_arg_exists

Check requested data argument exists in REDCap data
add_metadata

Supplement a supertibble with additional metadata fields
apply_labs_haven

Apply haven value labels to a vector
check_file_exists

Check if file already exists
as_supertbl

Add supertbl S3 class
bind_supertbl_metadata

Bind supertbl metadata
check_extra_field_values

Check data field for field values not in metadata
check_forms_exist

Check that all requested instruments are in REDCap project metadata
check_field_is_logical

Parse logical field and compile data for warning if parsing errors occurred