derive_param_rr: Adds a Parameter for Derived RR

Description Usage Arguments Details Value Author(s) Examples

View source: R/derive_adeg_params.R

Description

Adds a record for derived RR based on heart rate for each by group (e.g., subject and visit) where the source parameters are available.

Usage

1
2
3
4
5
6
7
8
derive_param_rr(
  dataset,
  by_vars,
  set_values_to = vars(PARAMCD = "RRR"),
  hr_code = "HR",
  get_unit_expr,
  filter = NULL
)

Arguments

dataset

Input dataset

The variables specified by the by_vars parameter, PARAMCD, and AVAL are expected.

The variable specified by by_vars and PARAMCD must be a unique key of the input dataset after restricting it by the filter condition (filter parameter) and to the parameters specified by hr_code.

by_vars

Grouping variables

For each group defined by by_vars an observation is added to the output dataset.

Permitted Values: list of variables

set_values_to

Variables to be set

The specified variables are set to the specified values for the new observations. For example vars(PARAMCD = "MAP") defines the parameter code for the new parameter.

Permitted Values: List of variable-value pairs

hr_code

HR parameter code

The observations where PARAMCD equals the specified value are considered as the heart rate assessments.

Permitted Values: character value

get_unit_expr

An expression providing the unit of the parameter

The result is used to check the units of the input parameters.

Permitted Values: A variable of the input dataset or a function call

filter

Filter condition

The specified condition is applied to the input dataset before deriving the new parameter, i.e., only observations fulfilling the condition are taken into account.

Permitted Values: a condition

Details

The analysis value of the new parameter is derived as

60000 / HR

Value

The input dataset with the new parameter added

Author(s)

Stefan Bundfuss

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
adeg <- tibble::tribble(
  ~USUBJID,      ~PARAMCD, ~PARAM,        ~AVAL,  ~AVALU,      ~VISIT,
  "01-701-1015", "HR",     "Heart Rate",   70.14, "beats/min", "BASELINE",
  "01-701-1015", "QT",     "QT Duration", 370,    "msec",      "WEEK 2",
  "01-701-1015", "HR",     "Heart Rate",   62.66, "beats/min", "WEEK 1",
  "01-701-1015", "RR",     "RR Duration", 710,    "msec",      "WEEK 2",
  "01-701-1028", "HR",     "Heart Rate",   85.45, "beats/min", "BASELINE",
  "01-701-1028", "QT",     "QT Duration", 480,    "msec",      "WEEK 2",
  "01-701-1028", "QT",     "QT Duration", 350,    "msec",      "WEEK 3",
  "01-701-1028", "HR",     "Heart Rate",   56.54, "beats/min", "WEEK 3",
  "01-701-1028", "RR",     "RR Duration", 842,    "msec",      "WEEK 2"
)

derive_param_rr(
  adeg,
  by_vars = vars(USUBJID, VISIT),
  set_values_to = vars(
    PARAMCD = "RRR",
    PARAM = "RR Duration Rederived (msec)",
    AVALU = "msec"
  ),
  get_unit_expr = AVALU
)

epijim/admiral documentation built on Feb. 13, 2022, 12:15 a.m.