Skip to contents

Define an event-specific group contrast

Usage

define_contrast(
  id,
  focal = NULL,
  reference = NULL,
  rationale,
  membership = NULL,
  event_id = NULL,
  reference_advantaged = FALSE
)

Arguments

id

Unique contrast name.

focal, reference

Functions accepting the people table and returning a logical vector. Missing membership remains unknown, not FALSE.

rationale

Substantive explanation of the comparison.

membership

Optional data frame with event_id, person_id, focal, reference. Supply either this table or both functions.

event_id

Optional event IDs to which the definition applies.

reference_advantaged

Whether the reference is explicitly designated advantaged for the D measure. Default FALSE.

Value

A contrast definition; audit_dp() stores evaluated memberships.

Examples

define_contrast("education", function(p) p$education == "lower",
  function(p) p$education == "higher", rationale = "Study-specific education contrast")
#> $id
#> [1] "education"
#> 
#> $focal
#> function (p) 
#> p$education == "lower"
#> <environment: 0x562bccc68f00>
#> 
#> $reference
#> function (p) 
#> p$education == "higher"
#> <environment: 0x562bccc68f00>
#> 
#> $rationale
#> [1] "Study-specific education contrast"
#> 
#> $membership
#> NULL
#> 
#> $event_id
#> NULL
#> 
#> $reference_advantaged
#> [1] FALSE
#> 
#> attr(,"class")
#> [1] "deliberation_contrast"