Type: Package
Title: Interactive Dendrograms for Visualizing Hierarchical Clusters with Prototypes
Version: 0.1.0
Description: Shiny app to interactively visualize hierarchical clustering with prototypes. For details on hierarchical clustering with prototypes, see Bien and Tibshirani (2011) <doi:10.1198/jasa.2011.tm10183>. This package currently launches the application.
License: GPL-3
Encoding: UTF-8
Imports: DT, dynamicTreeCut, methods, protoclust, rare, shiny, shinycssloaders, shinythemes, tools
Depends: R (≥ 4.0.0)
RoxygenNote: 7.1.2
Suggests: testthat (≥ 3.0.0)
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2022-05-17 16:03:30 UTC; andeek
Author: Andee Kaplan [aut, cre], Jacob Bien [aut], Mike Bostock [cph] (Author of included d3.js library), Brian Reavis [cph] (Author of included selectize.js library)
Maintainer: Andee Kaplan <andee.kaplan@colostate.edu>
Repository: CRAN
Date/Publication: 2022-05-18 16:30:08 UTC

Convert a generic hclust object to a protoclust object.

Description

Convert a generic hclust object to a protoclust object.

Usage

as.protoclust(hc, protos)

Arguments

hc

A generic hclust object using any linkage.

protos

A vector of prototype label indices for each branch in the dendrogram. The i-th element is the index of the prototype corresponding to the cluster formed on the i-th merge.

Value

An object of class protoclust with a user specified vector of representative prototypes for each cluster. This object is just like hclust but has an identical element:

merge, height, order

identical to the values returned by hclust

protos

a vector of length n - 1. The i-th element is the index of the prototype corresponding to the cluster formed on the i-th merge.


Get an hclust object consisting of the branch with root given by a particular interior node

Description

Get an hclust object consisting of the branch with root given by a particular interior node

Usage

branch(hc, merge.id)

Arguments

hc

protoclust object

merge.id

a particular interior node

Value

an hclust object consisting of the branch with root given by merge.id.


Dataset covid19

Description

This is a protoclust object for use with protoshiny. It is the hierarchical clustering of US counties using mobility data (proportion of people staying home at least 8 hours and proportion of people going into a restaurant).

Source

https://cmu-delphi.github.io/covidcast/covidcastR/


Dynamic element of class "d3graph"

Description

Dynamic element of class "d3graph"

Usage

dynGraph(inputoutputId)

Arguments

inputoutputId

ID of the input/output element


Dataset faces

Description

This is a protoclust object for use with protoshiny. It is the hierarchical clustering of 400 grayscale images of faces that correspond to 10 images of 40 individuals.

Source

https://www.kaggle.com/kasikrit/att-database-of-faces


Fix uploaded files are getting renamed

Description

Fix uploaded files are getting renamed

Usage

fixUploadedFilesNames(x)

Arguments

x

uploaded object


Extract cluster labels

Description

Extract cluster labels

Usage

get_clusters(hc)

Arguments

hc

A protoshiny object downloaded from the web interface.

Value

A vector of saved cluster assignments resulting from interaction in the protoshiny application.


Get clustering of leaves from merge_id

Description

This function expects a set of node id's of a hierarchical clustering object that would define a partition of the leaves. It returns a vector giving the implied clustering of the leaves (analogous to the output of 'stats::cutree').

Usage

get_cut_from_merge_id(hc, merge_id)

Arguments

hc

An object of class 'hclust'

merge_id

A numeric vector. Indexing of nodes should match that of the 'merge' matrix in an 'hclust' object. In particular, positive numbers specify interior nodes and negative numbers specify leaves. These nodes must define a partition of the leaves, meaning no node in 'merge_id' should be a descendant of another and every leaf should either be included directly or be the descendant of one of the interior nodes referenced by 'merge_id'.


Get the labels of each interior node

Description

Get the labels of each interior node

Usage

get_nodes_to_expand_info(hc, dc)

Arguments

hc

hclust object

dc

a vector of length n with integers between 0 and num_clusters such as is outputted by dynamicTreeCut::cutreeDynamicTree

Value

Returns an (n-1)-vector giving the labels of each interior node. A positive value means that all nodes in that node's subtree have that label. A value of -1 means that this node's children have different labels. A value of -2 means that at least one child has a value of -1. And so forth.


Given a clustering get the root-to-node paths for visible nodes

Description

This function returns the binary path from root to node for each node that should be displayed in order to return the input clustering. Note that this will only be possible for a clustering 'cl' in which each cluster corresponds to a branch of 'hc'.

Usage

get_paths_from_cut(hc, cl)

Arguments

hc

An object of class 'hclust'

cl

A numeric vector in the format of the output of 'stats::cutree' that gives the cluster memberships of each leaf.


Server function

Description

Server function

Usage

get_server()

UI function

Description

UI function

Usage

get_ui()

Load an object into a new environment

Description

Load an object into a new environment

Usage

load_obj(file)

Arguments

file

object to load into the new environment


Dataset movies

Description

This is a protoclust object for use with protoshiny. It is the hierarchical clustering of 13,816 movies based on users' ratings and taggings of movies.

Source

https://grouplens.org/datasets/movielens/25m/


Convert a protoclust object to a JSON tree

Description

Convert a protoclust object to a JSON tree

Usage

protoclust_to_json(proto_object)

Arguments

proto_object

protoclust object including merge, labels, and height


Dataset seaflow

Description

This is a protoclust object for use with protoshiny. It is the hierarchical clustering of 6,336 scatterplots resulting from continuous-time flow cytometry measurements of phytoplankton.

Source

Provided by Mattias Rolf Cape and Francois Ribalet.


Dynamic element of class "select_custom"

Description

Dynamic element of class "select_custom"

Usage

selectJS(inputoutputId)

Arguments

inputoutputId

ID of the input/output element


Get the upper cut of a protoclust object

Description

Gets the upper part of the tree when you cut at height h (or alternately to have k leaves). Returns a valid protoclust object. This new tree has a different indexing from the original tree. i.original can be used to recover the old indexing and merge.id indicates for each leaf of new tree that had been an interior node, the merge.id of it.

Usage

upper(hc, h = NULL, k = NULL)

Arguments

hc

protoclust object

h

cut height

k

number of leaves that upper cut should have

Value

hc

protoclust object representing the upper cut

i.original

index of each element in original tree

merge.id.leaf

merge.id from original tree of each leaf

merge.id.interior

merge.id from original tree of each interior node

h

cut height

n.original

number of objects in original tree


Run a local instance of protoshiny

Description

Run a local instance of protoshiny

Usage

visualize_hc()

Value

No return value, launches the protoshiny Shiny application.

Examples

## Not run: 
    visualize_hc()

## End(Not run)

Dataset words

Description

This is a protoclust object for use with protoshiny. It is the hierarchical clustering of 19,599 of the most common words from Grolier's Encyclopedia.

Source

https://cs.nyu.edu/~roweis/data.html

mirror server hosted at Truenetwork, Russian Federation.