Learn R Programming

LearnClust (version 1.1)

complementaryClusters: To check if two clusters are complementary

Description

To check if two clusters include every element but without repeating anyone.

Usage

complementaryClusters(components, cluster1, cluster2)

Arguments

components

is an elements list. It contains every component that has to be in one cluster or in the other one. But each element can only be included in one cluster.

cluster1

is a cluster (matrix).

cluster2

is a cluster (matrix).

Value

Boolean value.

Details

This function checks if the cluster that will be divided contains the simple elements that they have to include. They have to contain every element, but anyone should be duplicated.

The function will return a boolean value.

Examples

Run this code
# NOT RUN {
data <- c(1,2,1,3,1,4,1,5)

components <- toListDivisive(data)

cluster1 <- matrix(c(1,2,1,3),ncol=2)
cluster2 <- matrix(c(1,4,1,5),ncol=2)
cluster3 <- matrix(c(1,6,1,7),ncol=2)

complementaryClusters(components,cluster1,cluster2) #TRUE

complementaryClusters(components,cluster3,cluster2) #FALSE

# }

Run the code above in your browser using DataLab