Learn R Programming

ctrdata (version 1.22.0)

f.trialPhase: Calculate phase of a clinical trial

Description

Trial concept calculated: phase of a clinical trial as per ICH E8(R1).

Usage

f.trialPhase(df = NULL)

Value

data frame with columns `_id` and `.trialPhase`, which is an ordered factor with levels `phase 1`, `phase 1+2`, `phase 2`, `phase 2+3`, `phase 2+4`, `phase 3`, `phase 3+4`, `phase 1+2+3`, `phase 4`, `phase 1+2+3+4`.

Arguments

df

data frame such as from dbGetFieldsIntoDf. If `NULL`, prints fields needed in `df` for calculating this trial concept, which can be used with dbGetFieldsIntoDf.

Examples

Run this code
# fields needed
f.trialPhase()

# apply trial concept when creating data frame
dbc <- nodbi::src_sqlite(
  dbname = system.file("extdata", "demo.sqlite", package = "ctrdata"),
  collection = "my_trials", flags = RSQLite::SQLITE_RO)
trialsDf <- dbGetFieldsIntoDf(
  calculate = "f.trialPhase",
  con = dbc)
trialsDf

Run the code above in your browser using DataLab