check.classes: Check and clean class labels

check.classesR Documentation

Check and clean class labels

Description

Internal helper shared by the classification methods that cannot cope with empty classes. It coerces labels to a factor (which makes it work with character vectors, for which nlevels returns 0), drops the levels that are not observed (warning about them) and checks that at least two classes remain.

Usage

check.classes(labels, method = "", min.classes = 2)

Arguments

labels

Class labels (vector or factor).

method

The name of the calling method, used in the messages (a character string).

min.classes

The minimal number of (non-empty) classes required (default: 2).

Value

labels, as a factor with no empty level.


fdm2id documentation built on Aug. 28, 2026, 9:07 a.m.