CastorR: CastorR: Format Castor EDC CRF_export.xlsx file for R

Description Details

Description

These functions read the CRF_export.xlsx and formats the data for use in R, in particular, variables of class date, datetime, factor, and numeric.

Details

Strategy for labeling factor variables and setting variable classes

  1. Read data

    • Read all 'CRF_export.xlsx' file sheets and construct the structures to produce an Rdata file with (1) variable question labels, (2) correct factor levels with labels, and (3) correct data and numeric data types.

    • Data in 'Study results' has labels in 'Study variable list'

    • Data in other data sheets (between 'Study results' and 'Study variable list') has labels in 'Report variable list'

    • All factor groups with labels and levels are in 'Field options'

  2. Collect Option group names, levels, and labels

    • 'Field options' gives the factor variable levels and labels

    • 'Option group name'

    • 'Option name' labels list with 'Option value' list

  3. Assign variable question labels, Factor variables with Option groups, assign varible class data types

    • 'Study variable list' gives the question names for 'Study results'

    • 'Report variable list' gives the question names for other data sheets (between 'Study results' and 'Study variable list')

    • 'Variable name'

    • 'Field label' is the question name

      1. Use 'library(labelled)' with 'var_label()'

      2. For each variable, label it.

    • 'Optiongroup name'

      1. 1.Use 'factor()' for each variable using 'Option group name' labels and levels

    • 'Field type' variable data class, useful for date, datetime, and numeric.


erikerhardt/CastorR documentation built on May 4, 2019, 7:42 p.m.