- Home
- CRAN
**dendextend**: Extending R's Dendrogram Functionality**match_order_by_labels**: Adjust the order of one dendrogram based on another (using...

# Adjust the order of one dendrogram based on another (using labels)

### Description

Takes one dendrogram and adjusts its order leaves valeus based on the order of another dendrogram. The values are matached based on the labels of the two dendrograms.

This allows for faster entanglement running time, since we can be sure that the leaves order is just as using their labels.

### Usage

1 2 | ```
match_order_by_labels(dend_change, dend_template,
check_that_labels_match = TRUE)
``` |

### Arguments

`dend_change` |
tree object (dendrogram) |

`dend_template` |
tree object (dendrogram) |

`check_that_labels_match` |
logical (TRUE). If to check that the labels in the two dendrogram match. (if they do not, the function aborts) |

### Value

Returns dend_change after adjusting its order values to be like dend_template.

### See Also

entanglement , tanglegram

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
## Not run:
dend <- USArrests[1:4,] %>% dist %>% hclust %>% as.dendrogram
order.dendrogram(dend) # c(4L, 3L, 1L, 2L)
dend_changed <- dend
order.dendrogram(dend_changed) <- 1:4
order.dendrogram(dend_changed) # c(1:4)
# now let's fix the order of the new object to be as it was:
dend_changed <- match_order_by_labels(dend_changed, dend)
# these two are now the same:
order.dendrogram(dend_changed)
order.dendrogram(dend))
## End(Not run)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.

- all_couple_rotations_at_k: Rotate tree branches for k
- all_couple_rotations_at_k: Rotate tree branches for k
- all.equal.dendrogram: Global Comparison of two (or more) dendrograms
- all.equal.dendrogram: Global Comparison of two (or more) dendrograms
- all_unique: Check if all the elements in a vector are unique
- all_unique: Check if all the elements in a vector are unique
- as.dendlist: Try to coerce something into a dendlist
- as.dendlist: Try to coerce something into a dendlist
- as_hclust_fixed: Convert dendrogram Objects to Class hclust
- as_hclust_fixed: Convert dendrogram Objects to Class hclust
- as.phylo.dendrogram: Convert a dendrogram into phylo
- assign_dendextend_options: Populates dendextend functions into dendextend_options
- assign_dendextend_options: Populates dendextend functions into dendextend_options
- assign_values_to_branches_edgePar: Assign values to edgePar of dendrogram's branches
- assign_values_to_branches_edgePar: Assign values to edgePar of dendrogram's branches
- assign_values_to_leaves_edgePar: Assign values to edgePar of dendrogram's leaves
- assign_values_to_leaves_edgePar: Assign values to edgePar of dendrogram's leaves
- assign_values_to_leaves_nodePar: Assign values to nodePar of dendrogram's leaves
- assign_values_to_leaves_nodePar: Assign values to nodePar of dendrogram's leaves
- assign_values_to_nodes_nodePar: Assign values to nodePar of dendrogram's nodes
- bakers_gamma_for_2_k_matrix: Bakers Gamma for two k matrices
- bakers_gamma_for_2_k_matrix: Bakers Gamma for two k matrices
- Bk: Bk - Calculating Fowlkes-Mallows Index for two dendrogram
- Bk: Bk - Calculating Fowlkes-Mallows Index for two dendrogram
- Bk_permutations: Bk permutation - Calculating Fowlkes-Mallows Index for two...
- Bk_permutations: Bk permutation - Calculating Fowlkes-Mallows Index for two...
- Bk_plot: Bk plot - ploting the Fowlkes-Mallows Index of two dendrogram...
- Bk_plot: Bk plot - ploting the Fowlkes-Mallows Index of two dendrogram...
- branches_attr_by_clusters: Change col/lwd/lty of branches based on clusters
- branches_attr_by_clusters: Change col/lwd/lty of branches based on clusters
- branches_attr_by_labels: Change col/lwd/lty of branches matching labels condition
- branches_attr_by_labels: Change col/lwd/lty of branches matching labels condition
- circlize_dendrogram: Plot a circlized dendrograms
- circlize_dendrogram: Plot a circlized dendrograms
- click_rotate: Interactively rotate a tree object
- click_rotate: Interactively rotate a tree object
- collapse_branch: Collapse branches under a tolerance level
- collapse_branch: Collapse branches under a tolerance level
- color_branches: Color tree's branches according to sub-clusters
- color_branches: Color tree's branches according to sub-clusters
- colored_bars: Add colored bars to a dendrogram
- colored_bars: Add colored bars to a dendrogram
- color_labels: Color dend's labels according to sub-clusters
- color_labels: Color dend's labels according to sub-clusters
- color_unique_labels: Color unique labels in a dendrogram
- color_unique_labels: Color unique labels in a dendrogram
- common_subtrees_clusters: Find clusters of common subtrees
- common_subtrees_clusters: Find clusters of common subtrees
- cor_bakers_gamma: Baker's Gamma correlation coefficient
- cor_bakers_gamma: Baker's Gamma correlation coefficient
- cor_common_nodes: Proportion of commong nodes between two trees
- cor_common_nodes: Proportion of commong nodes between two trees
- cor_cophenetic: Cophenetic correlation between two trees
- cor_cophenetic: Cophenetic correlation between two trees
- cor.dendlist: Correlation matrix between a list of trees.
- cor.dendlist: Correlation matrix between a list of trees.
- cor_FM_index: Correlation of FM_index for some k
- cor_FM_index: Correlation of FM_index for some k
- count_terminal_nodes: Counts the number of terminal nodes (merging 0 nodes!)
- count_terminal_nodes: Counts the number of terminal nodes (merging 0 nodes!)
- cut_lower_fun: Cut a dendrogram - and run a function on the output
- cut_lower_fun: Cut a dendrogram - and run a function on the output
- cutree_1h.dendrogram: cutree for dendrogram (by 1 height only!)
- cutree_1h.dendrogram: cutree for dendrogram (by 1 height only!)
- cutree_1k.dendrogram: cutree for dendrogram (by 1 k value only!)
- cutree_1k.dendrogram: cutree for dendrogram (by 1 k value only!)
- cutree-methods: Cut a Tree (Dendrogram/hclust/phylo) into Groups of Data
- cutree-methods: Cut a Tree (Dendrogram/hclust/phylo) into Groups of Data
- d3dendrogram: Plot dendrogram to webpage and view.
- d3dendrogram: Plot dendrogram to webpage and view.
- d3dendro_options: Get or set current defaults for d3dendrogram
- d3dendro_options: Get or set current defaults for d3dendrogram
- dend_diff: Plots two trees side by side, highlighting edges unique to...
- dend_diff: Plots two trees side by side, highlighting edges unique to...
- dendextend_labels.dendrogram: Labels of the Leaves in a Dendrogram
- dendextend_labels.dendrogram: Labels of the Leaves in a Dendrogram
- dendextend_options: Access to dendextend_options
- dendextend_options: Access to dendextend_options
- dendextend-package: Functions for extending dendrogram objects
- dendextend-package: Functions for extending dendrogram objects
- dendlist: Creating a dendlist object from several dendrograms
- dendlist: Creating a dendlist object from several dendrograms
- DendSer.dendrogram: Tries to run DendSer on a dendrogram
- DendSer.dendrogram: Tries to run DendSer on a dendrogram
- dist.dendlist: Topological Distances Between Two dendrograms
- dist.dendlist: Topological Distances Between Two dendrograms
- distinct_edges: Finds distinct edges in one tree compared to another
- distinct_edges: Finds distinct edges in one tree compared to another
- dist_long: Turns a dist object to a "long" table
- dist_long: Turns a dist object to a "long" table
- duplicate_leaf: Duplicate a leaf X times
- duplicate_leaf: Duplicate a leaf X times
- entanglement: Measures entanglement between two trees
- entanglement: Measures entanglement between two trees
- fac2num: Turns a factor into a number
- fac2num: Turns a factor into a number
- find_k: Find the (estimated) number of clusters for a dendrogram...
- find_k: Find the (estimated) number of clusters for a dendrogram...
- fix_members_attr.dendrogram: Fix members attr in a dendrogram
- fix_members_attr.dendrogram: Fix members attr in a dendrogram
- flatten.dendrogram: Flatten the branches of a dendrogram's root
- flatten.dendrogram: Flatten the branches of a dendrogram's root
- flip_leaves: Flip leaves
- flip_leaves: Flip leaves
- FM_index: Calculating Fowlkes-Mallows Index
- FM_index: Calculating Fowlkes-Mallows Index
- FM_index_permutation: Calculating Fowlkes-Mallows Index under H0
- FM_index_permutation: Calculating Fowlkes-Mallows Index under H0
- FM_index_profdpm: Calculating Fowlkes-Mallows index using the profdpm R package
- FM_index_profdpm: Calculating Fowlkes-Mallows index using the profdpm R package
- FM_index_R: Calculating Fowlkes-Mallows index in R
- FM_index_R: Calculating Fowlkes-Mallows index in R
- get_branches_heights: Get height attributes from a dendrogram
- get_branches_heights: Get height attributes from a dendrogram
- get_childrens_heights: Get height attributes from a dendrogram's children
- get_childrens_heights: Get height attributes from a dendrogram's children
- get_leaves_attr: Get/set attributes of dendrogram's leaves
- get_leaves_attr: Get/set attributes of dendrogram's leaves
- get_leaves_branches_attr: Get an attribute of the branches of a dendrogram's leaves
- get_leaves_branches_attr: Get an attribute of the branches of a dendrogram's leaves
- get_leaves_branches_col: Get the colors of the branches of a dendrogram's leaves
- get_leaves_branches_col: Get the colors of the branches of a dendrogram's leaves
- get_leaves_edgePar: Get edgePar of dendrogram's leaves
- get_leaves_edgePar: Get edgePar of dendrogram's leaves
- get_leaves_nodePar: Get nodePar of dendrogram's leaves
- get_leaves_nodePar: Get nodePar of dendrogram's leaves
- get_nodes_attr: Get attributes of dendrogram's nodes
- get_nodes_attr: Get attributes of dendrogram's nodes
- get_nodes_xy: Get the x-y coordinates of a dendrogram's nodes
- get_nodes_xy: Get the x-y coordinates of a dendrogram's nodes
- get_root_branches_attr: get attributes from the dendrogram's root(!) branches
- get_root_branches_attr: get attributes from the dendrogram's root(!) branches
- ggdend: Creates dendrogram plot using ggplot.
- ggdend: Creates dendrogram plot using ggplot.
- hang.dendrogram: Hang dendrogram leaves
- hang.dendrogram: Hang dendrogram leaves
- heights_per_k.dendrogram: Which height will result in which k for a dendrogram
- heights_per_k.dendrogram: Which height will result in which k for a dendrogram
- highlight_distinct_edges: Highlight distint edges in a tree (compared to another one)
- highlight_distinct_edges: Highlight distint edges in a tree (compared to another one)
- identify.dendrogram: Identify Clusters in a Dendrogram (not hclust)
- identify.dendrogram: Identify Clusters in a Dendrogram (not hclust)
- intersect_trees: Intersect trees
- intersect_trees: Intersect trees
- is.dendlist: Checks if an object is of class dendlist
- is.dendlist: Checks if an object is of class dendlist
- is.dendrogram: Is the object of class dendrogram
- is.dendrogram: Is the object of class dendrogram
- is.dist: Checks if an object is of class dist
- is.dist: Checks if an object is of class dist
- is.hclust: Is the object of class hclust
- is.hclust: Is the object of class hclust
- is.natural.number: Check if numbers are natural
- is.natural.number: Check if numbers are natural
- is_null_list: Checks if the value is and empty list()
- is_null_list: Checks if the value is and empty list()
- is.phylo: Is the object of class phylo
- is.phylo: Is the object of class phylo
- khan: Microarray gene expression dataset from Khan et al., 2001....
- khan: Microarray gene expression dataset from Khan et al., 2001....
- labels-assign: "label" assignment operator
- labels-assign: "label" assignment operator
- labels_cex: Retrieve/assign cex to the labels of a dendrogram
- labels_cex: Retrieve/assign cex to the labels of a dendrogram
- labels_colors: Retrieve/assign colors to the labels of a dendrogram
- labels_colors: Retrieve/assign colors to the labels of a dendrogram
- ladderize: Ladderize a Tree
- ladderize: Ladderize a Tree
- leaf_Colors: Return the leaf Colors of a dendrogram
- leaf_Colors: Return the leaf Colors of a dendrogram
- lowest_common_branch: Find lowest common branch were the two items are shared
- lowest_common_branch: Find lowest common branch were the two items are shared
- match_order_by_labels: Adjust the order of one dendrogram based on another (using...
- match_order_by_labels: Adjust the order of one dendrogram based on another (using...
- match_order_dendrogram_by_old_order: Adjust the order of one dendrogram based on another (using...
- match_order_dendrogram_by_old_order: Adjust the order of one dendrogram based on another (using...
- na_locf: Last Observation Carried Forward
- na_locf: Last Observation Carried Forward
- nleaves: Counts the number of leaves in a tree
- nleaves: Counts the number of leaves in a tree
- nnodes: Counts the number of nodes (Vertices) in a tree
- nnodes: Counts the number of nodes (Vertices) in a tree
- noded_with_condition: Find which nodes satisfies a condition
- noded_with_condition: Find which nodes satisfies a condition
- order.dendrogram-assign: order.dendrogram<- assignment operator
- order.dendrogram-assign: order.dendrogram<- assignment operator
- order.hclust: Ordering of the Leaves in a hclust Dendrogram
- order.hclust: Ordering of the Leaves in a hclust Dendrogram
- partition_leaves: A list with labels for each subtree (edge)
- partition_leaves: A list with labels for each subtree (edge)
- plot_horiz.dendrogram: Plotting a left-tip-adjusted horizontal dendrogram
- plot_horiz.dendrogram: Plotting a left-tip-adjusted horizontal dendrogram
- prune: Prunes a tree (using leaves' labels)
- prune: Prunes a tree (using leaves' labels)
- prune_common_subtrees.dendlist: Prune trees to their common subtrees
- prune_common_subtrees.dendlist: Prune trees to their common subtrees
- prune_leaf: Trims one leaf from a dendrogram
- prune_leaf: Trims one leaf from a dendrogram
- pvclust_show_signif: The significant branches in a dendrogram, based on a pvclust...
- pvclust_show_signif: The significant branches in a dendrogram, based on a pvclust...
- pvclust_show_signif_gradient: Significance gradient of branches in a dendrogram (via...
- pvclust_show_signif_gradient: Significance gradient of branches in a dendrogram (via...
- raise.dendrogram: Raise the height of a dendrogram tree
- raise.dendrogram: Raise the height of a dendrogram tree
- rank_branches: Rank branches' heights
- rank_branches: Rank branches' heights
- rank_order.dendrogram: Fix rank of leaves order values in a dendrogram
- rank_order.dendrogram: Fix rank of leaves order values in a dendrogram
- rank_values_with_clusters: Rank a vector based on clusters
- rank_values_with_clusters: Rank a vector based on clusters
- rect.dendrogram: Draw Rectangles Around a Dendrogram's Clusters
- rect.dendrogram: Draw Rectangles Around a Dendrogram's Clusters
- reexports: Objects exported from other packages
- reexports: Objects exported from other packages
- remove_branches_edgePar: Remove all edgePar values from a dendrogram's branches
- remove_branches_edgePar: Remove all edgePar values from a dendrogram's branches
- remove_leaves_nodePar: Remove all nodePar values from a dendrogram's leaves
- remove_leaves_nodePar: Remove all nodePar values from a dendrogram's leaves
- remove_nodes_nodePar: Remove all nodePar values from a dendrogram's nodes
- remove_nodes_nodePar: Remove all nodePar values from a dendrogram's nodes
- rllply: recursivly apply a function on a list
- rllply: recursivly apply a function on a list
- rotate: Rotate a tree object
- rotate: Rotate a tree object
- rotate_DendSer: Rotates dend based on DendSer
- rotate_DendSer: Rotates dend based on DendSer
- sample.dendrogram: Sample a tree
- sample.dendrogram: Sample a tree
- seriate_dendrogram: Rotates a dendrogram based on a seriation of a distance...
- seriate_dendrogram: Rotates a dendrogram based on a seriation of a distance...
- set: Set (/update) features to a dendrogram
- set: Set (/update) features to a dendrogram
- set_labels: Set/place new labels in a dendrogram
- set_labels: Set/place new labels in a dendrogram
- shuffle: Random rotation of trees
- shuffle: Random rotation of trees
- sort_2_clusters_vectors: Sorts two clusters vector by their names
- sort_2_clusters_vectors: Sorts two clusters vector by their names
- sort_dist_mat: Sorts a distance matrix by rows and columns names
- sort_dist_mat: Sorts a distance matrix by rows and columns names
- sort_levels_values: Sort the values level in a vector
- sort_levels_values: Sort the values level in a vector
- tanglegram: Tanglegram plot
- tanglegram: Tanglegram plot
- theme_dendro: Creates completely blank theme in ggplot
- theme_dendro: Creates completely blank theme in ggplot
- unbranch: unbranch trees
- unbranch: unbranch trees
- unclass_dend: unclass an entire dendrogram tree
- unclass_dend: unclass an entire dendrogram tree
- untangle: untangle dendrograms
- untangle: untangle dendrograms
- untangle_DendSer: Tries to run DendSer on a dendrogram
- untangle_DendSer: Tries to run DendSer on a dendrogram
- untangle_random_search: Untangle - random search
- untangle_random_search: Untangle - random search
- untangle_step_rotate_1side: Stepwise untangle one tree compared to another
- untangle_step_rotate_1side: Stepwise untangle one tree compared to another
- untangle_step_rotate_2side: Stepwise untangle two trees one at a time
- untangle_step_rotate_2side: Stepwise untangle two trees one at a time
- which_leaf: Which node is a leaf?
- which_leaf: Which node is a leaf?
- which_node: Which node id is common to a group of labels
- which_node: Which node id is common to a group of labels