Function for clustering keys based on value content. Clustering or grouping is solely based on presence / absence of values across keys. For example, if we have the key - values of A = c(1, 2, 3), B = c(3, 4, 5), and C = c(6, 7, 8), then keys A and B will be clustered together because they share the value 3, but C will not be clustered with either A or B because it does not share any values with the respective keys. This type of clustering can be helpful for grouping keys based on unique IDs, such as readnames or character strings representing unique alignment locations.
vector coercible into a factor vector. Both key and val vectors need to be equal length. Output will be of equal length and in same input order.
options for output returned. "standard" will return a numeric vector of grouping IDs and is the default. "data.frame" will return a data.frame with key, val, and clus columns. "simple" will return a numeric vector of grouping IDs with the names associated with unique keys. Lastly, "graph" will return a simplifed graph with the keys as nodes and edges indicating which keys share values.
cluster_kv is a function that will cluster or group keys based on
values provided for the keys. Mutliple formats for 'return' are available.
Christopher Nobles, Ph.D.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.