processData {clinDataReview}R Documentation

Process a dataset.

Description

This function is intended to automate all data processing steps for use in the 'clinDataReview' reports using config files.

Usage

processData(data, processing, labelVars = NULL, ...)

Arguments

data

Data.frame with data.

processing

List with processing steps for the data. Each element in the list should be a named list containing the parameters for the specific processing function. The name specifies the processing step, among:

Multiple steps of each kind can be specified after each other (e.g. 1: filter, 2: transform, 3: filter, ...).
If a filter step is specified as a list of multiple filters, the filters are run independently of each other on the entire dataset (see the documentation of filters in filterData).
If filters should be run sequentially, i.e. filter from step 2 should be applied on the filtered dataset from step 1, separated filtering steps should be specified, e.g.
list(filter = list(var = "ANL01FL", value = "Y"), filter = list(var = "PARAM", value = "QTCF"))

labelVars

Named character vector containing variable labels.

...

Any parameters passed to all processing functions (if this parameter is available). If specified, these parameters shouldn't be specified also in processing.

Value

Data.frame with processed data, with extra attribute: labelVars.

Author(s)

Laure Cougnaud

Examples

library(clinUtils)

data(dataADaMCDISCP01)

dataLB <- dataADaMCDISCP01$ADLBC

# filter and annotate data
processData(
  data = dataLB,
  processing = list(
    list(filter = list(var = "ANL01FL", value = "Y")),
    list(annotate = list(vars = "ANRIND", varFct = 'factor(ANRIND, levels = c("L", "N", "H"))'))
  )
)

## multiple filtering steps:

# If these are specified in the same 'filter' step condition, these are considered independently,
# and the selected records combined with an 'AND' operator.
# Example: consider only records:
# - with analysis flag AND
# - from subject with high/low measurement (for all records) for each parameter
processData(
  data = dataLB,
  processing = list(
    list(filter = list(
      list(var = "ANL01FL", value = "Y"),
      list(var = "ANRIND", value = c("L", "H"), 
           postFct = any, varsBy = c("USUBJID", "PARAM"))
    )
    )
  )
)

# a custom operator to combine the selected records can be specified
# Example: consider only records:
# - with analysis flag OR
# - from subject with high/low measurement (for all records) for each parameter
processData(
  data = dataLB,
  processing = list(
    list(filter = list(
      list(var = "ANL01FL", value = "Y"),
      "|",
      list(var = "ANRIND", value = c("L", "H"), 
           postFct = any, varsBy = c("USUBJID", "PARAM"))
    )
    )
  )
)

# If the filtering conditions are specified in different filtering steps, these are
# considered sequentially.
# Example: 
# 1) consider only analysis records and 
# 2) from these records, consider only subject with high/low measurement for 
# each parameter
processData(
  data = dataLB,
  processing = list(
    list(filter = list(var = "ANL01FL", value = "Y")),
    list(filter = list(var = "ANRIND", value = c("L", "H"), 
      postFct = any, varsBy = c("USUBJID", "PARAM")))
  )
)
# Note for this particular 


[Package clinDataReview version 1.5.0 Index]