Skip to contents

Reads a label that q_label() wrote: q, two digits, x and one digit. Any other string gives NA.

Usage

q_value(label)

Arguments

label

A character vector of labels, for example "q02x5".

Value

A numeric vector of probabilities.

Details

q_value(q_label(p)) returns p only for a p on the 0.001 grid and below 1. Every probability that the package uses is on that grid.

See also

vignette("pipeline", package = "csalert"), whose naming-grammar section shows the round trip.

Other naming grammar functions: csfmt_interpret(), csfmt_parse(), csfmt_var(), q_label()

Examples

q_value(c("q02x5", "q50x0", "q97x5"))
#> [1] 0.025 0.500 0.975

# a string that is not a label gives NA, and so does the three-digit q100x0
q_value(c("q100x0", "not_a_label"))
#> [1] NA NA