del.node {phybase}R Documentation

Delete a node from the tree

Description

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

Usage

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

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)$nodes
del.node(6,spname,nodematrix)

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

[Package phybase version 1.1 Index]