Learn R Programming

fdm2id (version 1.0.1)

check.classes: 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)

Value

labels, as a factor with no empty level.

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).