Learn R Programming

apcluster (version 1.0.2)

labels-methods: Generate label vector from APResult object

Description

Generate a label vector from an APResult object

Usage

## S3 method for class 'APResult':
labels(object, type="names")

Arguments

object
An APResult object created by affinity propagation clustering
type
specifies which kind of label vector should be created, see details below;

Value

  • labels returns a label vector as long as the original data set

Details

The function labels creates a label vector for a data set previously clustered with affinity propagation. Which kind of labels are produced is controlled by the argument type: [object Object],[object Object],[object Object]

References

http://www.bioinf.jku.at/software/apcluster

Frey, B. J. and Dueck, D. (2007) Clustering by passing messages between data points. Science 315, 972-976.

See Also

APResult-class

Examples

Run this code
## create two Gaussian clouds
x <- c(1, 2, 3, 7, 8, 9)
names(x) <- c("a", "b", "c", "d", "e", "f")

## compute similarity matrix (negative squared distance)
sim <- negDistMat(x, r=2)

## run affinity propagation
apres <- apcluster(sim)

## show details of clustering results
show(apres)

## label vector (names of exemplars)
labels(apres)

## label vector (consecutive index of exemplars)
labels(apres, type="enum")

## label vector (index of exemplars within original data set)
labels(apres, type="exemplars")

Run the code above in your browser using DataLab