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

View source: R/SupplementaryFunctions.R

branch_singlesR Documentation

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)

Arguments

edges

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

Value

A dataframe comprising the augmented adjacency matrix.

Author(s)

Rob Noble, robjohnnoble@gmail.com

Examples

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


ggmuller documentation built on Feb. 16, 2023, 7:42 p.m.