Given a vector of values that match the labels of a range-based
format, returns the corresponding low / high bounds (and
inclusivity flags) for each input. Useful for reconstructing the
underlying range from a coded value.
Value
A data.frame with one row per element of x and
columns low, high, inc_low, inc_high.
Rows where the input does not match any range label contain NA.
Details
For multilabel formats where the same label maps to several
ranges, only the first matching range is returned. For full
multi-match behaviour, call franges() directly and join
on label.
Examples
fparse(text = '
VALUE visit_ther (numeric)
[LOW, 1] = 0
[ 8, 22] = 2
[22, 36] = 4
[37, 50] = 6
;
')
fmap_to_ranges(c(0, 2, 4, 6), "visit_ther")
#> low high inc_low inc_high
#> 1 -Inf 1 TRUE TRUE
#> 2 8 22 TRUE TRUE
#> 3 22 36 TRUE TRUE
#> 4 37 50 TRUE TRUE
fclear()
#> All formats cleared from library.