Installation

Install this package directly from GitHub:

devtools::install_github("UBC-MDS/kmeans_R")

Usage

Simple example demonstrating the functionality of this package:

library(kmeansR)

# generate synthetic data with three clusters
synth_data <- data.frame(
  x = c(rnorm(20,1,1), rnorm(30,6,3), rnorm(15,10,2)),
  y = c(rnorm(20,5,2), rnorm(30,2,2), rnorm(15,8,3))
)

# initialize the cluster centers
centers <- kmeans_init(data= synth_data, K = 3)
# cluster the data points
clusters <- kmeans_cluster(data = synth_data, centers = centers)
# generate summary results
report <- kmeans_report(synth_data, clusters$assignments)

# plot the clustered data
report$plot

Overview

kmeans_R is an R package aimed towards a user-friendly way of exploring and implementing k-means clustering.

The package integrates and simplifies different functions, such as kmeans and KMeans_rcpp, into one easy-to-use package.

The package includes the following functions:



UBC-MDS/kmeans_R documentation built on May 22, 2019, 2:26 p.m.