Learn R Programming

partitionComparison (version 0.2.6)

registerPartitionVectorSignatures: Make comparison measures usable with any vectors

Description

The comparison measures are defined to use the class Partition as parameters. If you do not want to explicitly convert an arbitrary vector of class labels (probably as a result from another package's algorithm) into a Partition instance, calling this function will create methods for all measures that allow "ANY" input which is implicitly converted to Partition.

Usage

registerPartitionVectorSignatures(e)

Arguments

e

The environment to register the methods in (mostly environment() is fine)

Author

Fabian Ball fabian.ball@kit.edu

Examples

Run this code
library(partitionComparison)
randIndex(new("Partition", c(0, 0, 0, 1, 1)), new("Partition", c(0, 0, 1, 1, 1)))
# [1] 0.6
if (FALSE) randIndex(c(0, 0, 0, 1, 1), c(0, 0, 1, 1, 1))
# Error in (function (classes, fdef, mtable) :
# unable to find an inherited method for function 'randIndex' for signature '"numeric", "numeric"'
registerPartitionVectorSignatures(environment())
randIndex(c(0, 0, 0, 1, 1), c(0, 0, 1, 1, 1))
# [1] 0.6

Run the code above in your browser using DataLab