del.node: Delete a node from the tree

Description Usage Arguments Details Value Author(s) See Also Examples

Description

This function deletes a node (and its descendant nodes) from the tree.

Usage

1
del.node(inode, name, nodematrix)

Arguments

inode

the node to be deleted

name

the species names

nodematrix

the tree node matrix

Details

The species names are those defined in the original tree before deleting the node inode. No need to delete the species name of inode! If inode is an internode, the whole subtree below inode will be deleted.

Value

nodes

the tree node matrix after deleting inode

treestr

the tree string of the tree after deleting inode.

Author(s)

Liang Liu

See Also

change.root, swap.nodes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
treestr<-"((((H:0.00402,C:0.00402):0.00304,G:0.00707):0.00929,O:0.01635):0.1,W:0.12);"
spname<-read.tree.nodes(treestr)$names
nodematrix<-read.tree.nodes(treestr,spname)$nodes
del.node(6,spname,nodematrix)

##unrooted tree
data(unrooted.tree)
name<-paste("S",1:29,sep="")
nodematrix<-read.tree.nodes(unrooted.tree[1])$nodes
del.node(6,name,nodematrix)

bomeara/phybase documentation built on May 12, 2019, 11:35 p.m.