Add dataframe columns detailing ordering and groups from a dendrogram
Source:R/dataframe.R
add_cluster_info.Rd
Add dataframe columns detailing ordering and groups from a dendrogram
Usage
add_cluster_info(
df,
dend,
h = NULL,
k = NULL,
colnames = NULL,
idcol = c("key", "id", "root_id", "bodyid")
)
Arguments
- df
A dataframe e.g. as returned by
coconatfly::cf_meta
- dend
A
dendrogram
orhclust
object- h
A height to cut the dendrogram
- k
A number of clusters to cut the dendrogram
- colnames
The names of the two new columns
- idcol
The name of the column containing id information. If you do not provide this argument then the function will choose the first of three default columns present in
df
(with a warning when >1 column present).