UnsupervisedClusters: UnsupervisedClusters

Description Usage Arguments Value Examples

Description

This function performs unsupervised clustering on a dataset. This technique can be useful to detect hidden trends in the data, as well as outliers and odd behaviors. Works best with smaller datasets - more than a few thousand can slow greatly and be less useful

Usage

1
2
UnsupervisedClusters(datain, plottype = "fan", forceclusters = NULL,
  classification = NULL)

Arguments

datain

a dataframe which will be clustered

plottype

one of the following: "dendogram", "fan", "radial","unrooted","cladogram"

forceclusters

allows for specification of number of clusters. If NULL, the best number will be calculated.

classification

optional - a vector with true class values. If given, a confusion matrix will be output

Value

datain, but with an added column with clusters

Examples

1
2
3
4
5
6
7
8
9
set.seed(1)
datain <- data.frame(matrix(rnorm(400), nrow=100))

dataout <- UnsupervisedClusters(datain)

dataout$index <- 1:length(dataout[,1])
graphme <- reshape::melt(dataout, id=c("index", "cluster"))
ggplot2::ggplot(graphme, ggplot2::aes(x=index, y=value, color=cluster)) +
 ggplot2::geom_point() + ggplot2::facet_wrap(~variable) + theme_GR()

grieman/grieman documentation built on May 17, 2019, 8:36 a.m.