Learn R Programming

cards (version 0.5.1)

ard_pairwise: Pairwise ARD

Description

Utility to perform pairwise comparisons.

Usage

ard_pairwise(data, variable, .f, include = NULL)

Value

list of ARDs

Arguments

data

(data.frame)
a data frame

variable

(tidy-select)
Column to perform pairwise analyses for.

.f

(function)
a function that creates ARDs. The function accepts a single argument and a subset of data will be passed including the two levels of variable for the pairwise analysis.

include

(vector)
a vector of levels of the variable column to include in comparisons. Pairwise comparisons will only be performed for pairs that have a level specified here. Default is NULL and all pairwise computations are included.

Examples

Run this code
ard_pairwise(
  ADSL,
  variable = ARM,
  .f = \(df) {
    ard_complex(
      df,
      variables = AGE,
      statistic = ~ list(ttest = \(x, data, ...) t.test(x ~ data$ARM)[c("statistic", "p.value")])
    )
  },
  include = "Placebo" # only include comparisons to the "Placebo" group
)

Run the code above in your browser using DataLab