Companion to fmap_ranges for the stratified_range
format type. Each row pairs a stratum (e.g. study arm, subject id, or a
composite key produced by fputk()) with a numeric / Date /
POSIXct range and a label. The returned ks_fmap vector carries
the chosen sep as an attribute so that
fnew(type = "stratified_range") picks it up automatically.
Usage
fmap_strata(
stratum,
low,
high,
label,
inc_low = TRUE,
inc_high = FALSE,
sep = "|",
date_format = NULL
)Arguments
- stratum
Character vector of stratum identifiers.
- low, high
Range bounds. See
fmap_ranges.- label
Character vector of labels.
- inc_low, inc_high
Logical, length 1 or
length(low). Seefmap_ranges.- sep
Separator inserted between stratum and range key. Must match the
sepsubsequently passed tofputk.- date_format
Optional strptime format string.
Examples
visits <- fmap_strata(
stratum = c("ARM_A", "ARM_A", "ARM_B"),
low = c(0, 7, 0),
high = c(7, 14, 10),
label = c("Baseline", "Week 1", "Baseline")
)
fnew(visits, type = "stratified_range", range_subtype = "numeric",
name = "visit_window")
fputk(c("ARM_A", "ARM_B"), c(3, 5), format = "visit_window")
#> [1] "Baseline" "Baseline"
fclear()
#> All formats cleared from library.