Learn R Programming

ggmuller (version 0.5.6)

branch_singles: Add branches of length zero to get rid of single nodes in an adjacency matrix

Description

Single nodes are those with exactly one daughter. This function is required by adj_matrix_to_tree, since valid "phylo" objects cannot contain single nodes. If pre-existing branches lack lengths then these are set to 1.

Usage

branch_singles(edges)

Value

A dataframe comprising the augmented adjacency matrix.

Arguments

edges

Dataframe comprising an adjacency matrix, with column names "Parent" and "Identity"

Author

Rob Noble, robjohnnoble@gmail.com

Examples

Run this code
edges1 <- data.frame(Parent = c(1,1,1,3), Identity = 2:5)
branch_singles(edges1)

Run the code above in your browser using DataLab