Learn R Programming

predkmeans (version 0.1.1)

assignCluster: Make Cluster Assignments

Description

Assigns observation to the nearest cluster center, using squared Euclidean distance.

Usage

assignCluster(X, centers)

Arguments

X

matrix of observations

centers

matrix of cluster centers

Value

A vector of cluster labels

Examples

Run this code
# NOT RUN {
X <- matrix(rnorm(100*5), nrow=100, ncol=5)
centers <- matrix(runif(3*5), nrow=3, ncol=5)

cl <- assignCluster(X, centers)
table(cl)
# }

Run the code above in your browser using DataLab