powered by
Format and hierarchically cluster a data.frame. If hclust could not normally be produced (usually because no samples are in common for a feature) pad the matrix with zeros and still calculate the distance
hclust_order( df, feature_pk, sample_pk, value_var, cluster_dim, distance_measure = "dist", hclust_method = "ward.D2" )
a list containing a hierarchically clustered set of rows and/or columns
data.frame to cluster
variable uniquely defining a row
variable uniquely defining a sample
An abundance value to use with hclust
hclust
rows, columns, or both
variable to use for computing dis-similarity
pearson correlation
euclidean distance
method from stats::hclust to use for clustering
library(dplyr) df <- tidyr::crossing(letters = LETTERS, numbers = 1:10) %>% mutate(noise = rnorm(n())) hclust_order(df, "letters", "numbers", "noise", "rows")
Run the code above in your browser using DataLab