Helper function for funtions that accept a quant_pairs
argument.
Validates/formats the given pairs, or infers the quantile pairs from forecast data.
Examples
# infer from forecast
casteval:::parse_quant_pairs(
NULL,
data.frame(time=1, val_q10=2, val_q25=3, val_50=4, val_q75=5, val_q90=6)
)
#> [[1]]
#> [1] 10 90
#>
#> [[2]]
#> [1] 25 75
#>
# single pair
casteval:::parse_quant_pairs(
c(2.5,97.5),
data.frame(time=1, val=1)
)
#> [[1]]
#> [1] 2.5 97.5
#>
# multiple pairs
casteval:::parse_quant_pairs(
list(c(2.5,97.5), c(25,75)),
data.frame(time=1, val=1)
)
#> [[1]]
#> [1] 2.5 97.5
#>
#> [[2]]
#> [1] 25 75
#>
# allow empty
casteval:::parse_quant_pairs(
NULL,
data.frame(time=1:3, val_q50=4:6),
allow_empty=TRUE
)
#> list()
casteval:::parse_quant_pairs(
list(),
data.frame(time=1, val=1),
allow_empty=TRUE
)
#> list()