Learn R Programming

kpodclustr (version 1.0)

kmpp: k-means++

Description

kmpp Computes initial centroids via kmeans++

Usage

kmpp(X, k)

Arguments

X
Data matrix whose rows are observations and columns are features
k
Number of clusters.

Value

A data matrix whose rows contain initial centroids for the k clusters

Examples

Run this code
n <- 10
p <- 2
X <- matrix(rnorm(n*p),n,p)
k <- 3
kmpp(X,k)

Run the code above in your browser using DataLab