| fmap_ranges | R Documentation |
Construct a ks_fmap-classed named character vector whose names
encode numeric / Date / POSIXct range bounds and whose values are the
corresponding labels. The result is intended to be passed to
fnew as a single positional argument (it suppresses the
default name reversal).
fmap_ranges(
low,
high,
label,
inc_low = TRUE,
inc_high = FALSE,
date_format = NULL
)
low, high |
Numeric, |
label |
Character vector of labels (same length as |
inc_low, inc_high |
Logical, length 1 or |
date_format |
Optional strptime format string used when formatting
|
Bounds are formatted as ISO 8601: "%Y-%m-%d" for Date,
"%Y-%m-%d %H:%M:%S" (UTC) for POSIXct. Override with
date_format if needed.
A ks_fmap object (named character vector) suitable for
passing to fnew().
fmap, fmap_strata, fnew
rng <- fmap_ranges(
low = c(0, 18, 65),
high = c(18, 65, Inf),
label = c("Child", "Adult", "Senior"),
inc_high = c(FALSE, FALSE, TRUE)
)
fnew(rng, type = "numeric", name = "age_groups")
fput(c(5, 25, 90), "age_groups")
fclear()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.