hclust_dendrogram: Hierarchical clustering dendrogram

Description Usage Arguments Details Examples

View source: R/lipidome_comparison_clustering.R

Description

'hclust_dendrogram' takes a data frame and prints a dendrogram.

Usage

1
2
3
4
5
6
hclust_dendrogram(
  hclust_element,
  labs = hclust_element$labels,
  title = "Hierarchical clustering",
  out_path = "none"
)

Arguments

hclust_element

object of class hclust.

labs

vector. Labels of dendrogram. Default: hclust_element$labels

title

string. Plot title. Default = "Hierarchical clustering".

out_path

string. Path to save plot to png. Default = to device.

Details

This function takes a data frame and transforms it into a matrix. The given matrix is then used to perform hiererchical clustering with the average, single or complete linkage. The clustering is plotted in a dendrogram.

Examples

1
2
3
4
5
6
7
8
US_clust <- stats::hclust(stats::dist(USArrests, method = "euclidean"), method = "average")
hclust_dendrogram(US_clust)
hclust_dendrogram(US_clust, labs = 1:nrow(USArrests))
## Not run: 
dir.create(paste(getwd(), "/examples", sep = ""), showWarnings = FALSE)
dir <- paste(getwd(), "/examples/USArrests", sep = "")
hclust_dendrogram(US_clust, out_path = dir)
## End(Not run)

lisaschneider0509/lipidomeComparisonR documentation built on Aug. 12, 2020, 12:52 a.m.