R/starTree.R

Defines functions starTree

Documented in starTree

# Function creates a polytomous tree
# written by Liam Revell 2011

starTree<-function(species,branch.lengths=NULL){
	n<-length(species)
	edge<-matrix(NA,n,2)
	if(!is.null(branch.lengths)) edge.length=branch.lengths
	edge[,1]<-n+1; edge[,2]<-1:n
	if(!is.null(branch.lengths)) phy<-list(edge=edge,edge.length=edge.length,Nnode=1,tip.label=as.vector(species))
	else phy<-list(edge=edge,Nnode=1,tip.label=as.vector(species))
	class(phy)<-"phylo"
	return(phy)
}

Try the phytools package in your browser

Any scripts or data that you put into this service are public.

phytools documentation built on June 22, 2024, 10:39 a.m.