predict.hca: Predict function for hierarchical clustering
Description
Returns the cluster whose centre is closest, for a new dataset. A dendrogram says nothing
about observations it was not built on, so the rule is the usual one: the clusters of the
cut are summarised by their centres, and a new observation joins the nearest.
Usage
# S3 method for hca
predict(object, newdata, k = NULL, ...)
Value
A vector of cluster numbers.
Arguments
object
The clustering (created by HCA).
newdata
A new dataset (a data.frame), with the same variables as the learning
dataset.
k
The number of clusters the dendrogram is cut into. Defaults to the cut
HCA already made, when it made one.