Learn R Programming

specmine (version 1.0)

clustering: Perform cluster analysis

Description

Perform cluster analysis on the dataset.

Usage

clustering(dataset, method = "hc", distance = "euclidean", type = "samples", num.clusters = 5, clustMethod = "complete")

Arguments

dataset
list representing the dataset from a metabolomics experiment.
method
a string describing the method of clustering. Possible types are:
  • "hc" perform hierarchical clustering.
  • "kmeans" perform kmeans clustering.

distance
the distance measure to be used to compute the distances between the rows of a data matrix. Possible types are "euclidean", "manhattan", "pearson" or "spearman". Only for hierarchical clustering.
type
a string indicating if cluster analysis will be performed on samples ("samples") or on variables ("variables").
num.clusters
the number of clusters in k-means cluster analysis.
clustMethod
Cluster method for hierarchical clustering.

Value

An object of class kmeans or hclust with the clustering results.

Examples

Run this code
  ## Example of kmeans and hierarchical clustering
  data(cachexia)
  hc.result = clustering(cachexia, method = "hc", 
	      distance = "euclidean")
  kmeans.result = clustering(cachexia, method = "kmeans", 
		  num.clusters = 4)

Run the code above in your browser using DataLab