Skip to contents

Convert a REDCap data dictionary to the OCA data sharing standard

Usage

dict_from_redcap(x)

Arguments

x

A data.frame reflecting a REDCap data dictionary

Value

A tibble-style data frame representing a data dictionary formatted to the OCA data sharing standard

Examples

# path to example REDCap data dictionary
path_data <- system.file("extdata", package = "datadict")
path_redcap_dict <- file.path(path_data, "REDCapDataDictionaryDemo.csv")

# read dictionary
redcap_dict <- read.csv(path_redcap_dict)

# convert to OCA format
dict_from_redcap(redcap_dict)
#> # A tibble: 122 × 19
#>    variable_name short_label           type  choices origin status form_or_group
#>    <chr>         <chr>                 <chr> <chr>   <chr>  <chr>  <chr>        
#>  1 study_id      Study ID              Free… NA      origi… shared demographics 
#>  2 date_enrolled Date subject signed … Date  NA      origi… shared demographics 
#>  3 first_name    First Name            Free… NA      origi… shared demographics 
#>  4 last_name     Last Name             Free… NA      origi… shared demographics 
#>  5 address       Street, City, State,… Free… NA      origi… shared demographics 
#>  6 telephone_1   Phone number          Free… NA      origi… shared demographics 
#>  7 telephone_2   Second phone number   Free… NA      origi… shared demographics 
#>  8 email         E-mail                Free… NA      origi… shared demographics 
#>  9 sex           Gender                Code… 0, Fem… origi… shared demographics 
#> 10 given_birth   Has the subject give… Code… 0, No … origi… shared demographics 
#> # ℹ 112 more rows
#> # ℹ 12 more variables: indirect_identifier <chr>, section_header <chr>,
#> #   calculation <chr>, field_note <chr>, validation_min <dbl>,
#> #   validation_max <dbl>, identifier <chr>, branching_logic <chr>,
#> #   required_field <chr>, custom_alignment <lgl>,
#> #   question_number_surveys_only <lgl>, matrix_group_name <chr>