Skip to contents

Deterministically classify numeric results using explicit boundaries

Usage

cr_classify_result(
  value,
  negative_upper,
  positive_lower,
  labels = c(negative = "NEGATIVE", indeterminate = "INDETERMINATE", positive =
    "POSITIVE")
)

Arguments

value

Numeric vector.

negative_upper, positive_lower

Explicit finite boundaries. Values at negative_upper are negative; values at positive_lower are positive; values between are indeterminate.

labels

Named character vector containing negative, indeterminate, and positive.

Value

Character vector with missing/non-finite inputs returned as NA.

Examples

cr_classify_result(c(0.5, 1, 1.5, 2, NA), negative_upper = 1, positive_lower = 2)
#> [1] "NEGATIVE"      "NEGATIVE"      "INDETERMINATE" "POSITIVE"     
#> [5] NA