set_positive_class: Set positive class

View source: R/utils_supervised.R

set_positive_classR Documentation

Set positive class

Description

Checks and sets the positive class for binary classification in a tabular dataset.

Usage

set_positive_class(x, positive_class)

Arguments

x

Tabular data, i.e. data.frame, data.table, or tbl_df (tibble): Input dataset. The last column will be treated as the outcome variable.

positive_class

Character scalar: The name of the positive class. Must be one of the levels of the outcome variable.

Value

Tabular data of the same class as x, with the positive class set as the second level of the outcome factor.

Author(s)

EDG

Examples

dat <- data.frame(x = rnorm(100), y = factor(sample(c("Case", "Control"), 100, replace = TRUE)))
levels(dat[["y"]])
dat <- set_positive_class(dat, "Case")
levels(dat[["y"]])

rtemis documentation built on Oct. 20, 2026, 1:06 a.m.