R/treeshape.R

"treeshape" <-
function(nodes, names){

#nodes est une matrice a deux colonnes
	if (!(is.matrix(nodes)) || (ncol(nodes) != 2)) {
		stop("invalid argument")
	}
#names est un vecteur a n elements.
	if (missing(names)) {
		names=paste("tip",as.character(1:(nrow(nodes)+1)))
	}
	
	if (length(names)!=nrow(nodes)+1){
		stop("Wrong number of elements for vector names")
	}
	
	res <- list(merge=nodes, names=names)
	class(res)<-'treeshape'
	
	res
}

Try the apTreeshape package in your browser

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

apTreeshape documentation built on Jan. 8, 2021, 2:07 a.m.