Skip to contents

Label groups based on a given cutoff

Usage

labelBasedOnCutoff(data, cutoff, label = NULL, gte = TRUE)

Arguments

data

Numeric: test data

cutoff

Numeric: test cutoff

label

Character: label to prefix group names

gte

Boolean: test using greater than or equal than cutoff (TRUE) or less than or equal than cutoff (FALSE)?

Value

Labelled groups

Examples

labelBasedOnCutoff(data=c(1, 0, 0, 1, 0, 1), cutoff=0.5)
#> [1] ">= 0.5" "< 0.5"  "< 0.5"  ">= 0.5" "< 0.5"  ">= 0.5"

labelBasedOnCutoff(data=c(1, 0, 0, 1, 0, 1), cutoff=0.5, "Ratio")
#> [1] "Ratio >= 0.5" "Ratio < 0.5"  "Ratio < 0.5"  "Ratio >= 0.5"
#> [5] "Ratio < 0.5"  "Ratio >= 0.5"

# Use "greater than" instead of "greater than or equal to"
labelBasedOnCutoff(data=c(1, 0, 0, 0.5, 0, 1), cutoff=0.5, gte=FALSE)
#> [1] "> 0.5"  "<= 0.5" "<= 0.5" "<= 0.5" "<= 0.5" "> 0.5"