del.node: Delete a node from the tree

del.nodeR 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

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

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

lliu1871/phybase documentation built on April 21, 2024, 3:16 a.m.