Filters a data frame based on a condition and records the effect of that filter (number retained and excluded) in the STROBE tracking table. Steps are automatically numbered and linked in sequence.
Arguments
- data
A data frame to be filtered.
- condition
A filtering condition as a character string (e.g.,
"age >= 18"
).- inclusion_label
A human-readable description of the remaining cohort after filtering.
- exclusion_reason
Optional. A label describing the exclusion criterion, which will be shown as a side box in the STROBE diagram. If NULL, no exclusion box will be added.
Examples
if (FALSE) {
df <- strobe_initialize(my_data)
df <- strobe_filter(df,
condition = "age >= 18",
inclusion_label = "Age ≥ 18",
exclusion_reason = "Excluded: Age < 18"
)
}