Learn R Programming

hierarchicalSets (version 1.0.4)

create_hierarchy: Create and store hierarchcical sets

Description

HierarchicalSet object can be created using the hSet() constructor. The resulting object will contain both the underlying sets as well as the resulting clustering.

Usage

create_hierarchy(sets, intersectLimit = 1)

# S3 method for HierarchicalSet print(x, ...)

# S3 method for HierarchicalSet [[(x, i)

# S3 method for HierarchicalSet [(x, i)

# S3 method for HierarchicalSet sets(x)

# S3 method for HierarchicalSet clusters(x)

# S3 method for HierarchicalSet set_names(x)

# S3 method for HierarchicalSet element_names(x)

# S3 method for HierarchicalSet n_sets(x)

# S3 method for HierarchicalSet length(x)

# S3 method for HierarchicalSet n_elements(x)

# S3 method for HierarchicalSet n_clusters(x)

# S3 method for HierarchicalSet cluster_sizes(x)

# S3 method for HierarchicalSet set_sizes(x)

# S3 method for HierarchicalSet cluster_members(x)

# S3 method for HierarchicalSet set_membership(x)

Value

An object of class HierarchicalSet

Arguments

sets

The sets to analyse. Can either be a matrix/data.frame giving the presence/absence pattern of elements, with elements as rows and sets as columns, or a list of vectors giving the elements of the individual sets.

intersectLimit

The proportion of sets an element must be present in to be considered part of the intersect. Standard intersects require it to be present in all sets (intersectLimit = 1), which is also the default

x

A HierarchicalSet object

...

Currently ignored

i

The index of the dendrogram

Functions

  • print(HierarchicalSet): Print method for HierarchicalSet objects

  • [[: Extract dendrogram objects from HierarchicalSet objects

  • [: Subset HierarchicalSet object by dendrogram (preserving set information and class)

  • sets(HierarchicalSet): Extract the sets as a sparse matrix

  • clusters(HierarchicalSet): Extract the clusters as a list of dendrograms

  • set_names(HierarchicalSet): Get the names of the sets

  • element_names(HierarchicalSet): Get the names of the elements

  • n_sets(HierarchicalSet): Get the number of sets

  • length(HierarchicalSet): Get the number of sets

  • n_elements(HierarchicalSet): Get the number of elements

  • n_clusters(HierarchicalSet): Get the number of clusters

  • cluster_sizes(HierarchicalSet): Get the size of each clusters

  • set_sizes(HierarchicalSet): Get the size of each set

  • cluster_members(HierarchicalSet): Get the members of each clusters

  • set_membership(HierarchicalSet): Get the membership of each set

Details

The HierarchicalSet class contains both the clustering and the original sets. The former is stored in a list of dendrogram objects in and the latter as a presence/absence matrix. Both are retrivable using $clusters and $sets respectively. Furthermore individual dendrograms can be extracted directly using the [[ operator. If multiple independent clusters exists the object can be subsetted using the [ operator.

For plotting functionality see the separate plot documentation for plot.HierarchicalSet().

Examples

Run this code
data('twitter')

# Caclulate the clustering
twitSet <- create_hierarchy(twitter)

# Some statistics on the data
n_sets(twitSet)
n_elements(twitSet)
n_clusters(twitSet)

# Focus on the first two independent cluster
twitSet[1:2]

# Extract a dendrogram representation of the firrst cluster
twitSet[[1]]

Run the code above in your browser using DataLab