Skip to contents

Assign new data to existing clusters without re-fitting

Usage

# S3 method for class 'morie_cluster'
predict(object, newdata, ...)

Arguments

object

A morie_cluster.

newdata

New numeric data with the training columns.

...

Unused.

Value

Integer cluster labels for the new rows (named by row name).

Examples

x <- iris[1:4]
rownames(x) <- paste0("s", seq_len(nrow(x)))  # labelled cases, as morie_cluster() expects
cl <- morie_cluster(x, k = 3)
predict(cl, x[1:5, ])
#> s1 s2 s3 s4 s5 
#>  2  2  2  2  2