From 2e3b8be33765d5311e071efb39871249d16f7e30 Mon Sep 17 00:00:00 2001 From: paradis Date: Tue, 8 Jan 2008 11:57:26 +0000 Subject: [PATCH] new function rmtree git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@12 6e262413-ae40-0410-9e79-b911bd7a66b7 --- Changes | 9 +++++++++ DESCRIPTION | 4 ++-- R/rtree.R | 12 ++++++++++-- man/rtree.Rd | 9 +++++++++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Changes b/Changes index a145133..adeee97 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,12 @@ + CHANGES IN APE VERSION 2.1-1 + + +NEW FEATURES + + o The new function rmtree generates lists of random trees. + + + CHANGES IN APE VERSION 2.1 diff --git a/DESCRIPTION b/DESCRIPTION index fb34c8e..60c2368 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ape -Version: 2.1 -Date: 2008-01-03 +Version: 2.1-1 +Date: 2008-01-08 Title: Analyses of Phylogenetics and Evolution Author: Emmanuel Paradis, Ben Bolker, Julien Claude, Hoa Sien Cuong, Richard Desper, Benoit Durand, Julien Dutheil, Olivier Gascuel, diff --git a/R/rtree.R b/R/rtree.R index 2e1a8a4..6d0172c 100644 --- a/R/rtree.R +++ b/R/rtree.R @@ -1,8 +1,8 @@ -## rtree.R (2007-12-22) +## rtree.R (2008-01-08) ## Generates Random Trees -## Copyright 2004-2007 Emmanuel Paradis +## Copyright 2004-2008 Emmanuel Paradis ## This file is part of the R-package `ape'. ## See the file ../COPYING for licensing issues. @@ -138,3 +138,11 @@ rcoal <- function(n, tip.label = NULL, br = rexp, ...) ## to avoid crossings when converting with as.hclust: read.tree(text = write.tree(phy)) } + +rmtree <- function(N, n, rooted = TRUE, tip.label = NULL, br = runif, ...) +{ + a <- replicate(N, rtree(n, rooted = rooted, tip.label = tip.label, + br = br, ...), simplify = FALSE) + class(a) <- "multiPhylo" + a +} diff --git a/man/rtree.Rd b/man/rtree.Rd index 96116f9..63cbf79 100644 --- a/man/rtree.Rd +++ b/man/rtree.Rd @@ -5,6 +5,7 @@ \usage{ rtree(n, rooted = TRUE, tip.label = NULL, br = runif, ...) rcoal(n, tip.label = NULL, br = rexp, ...) +rmtree(N, n, rooted = TRUE, tip.label = NULL, br = runif, ...) } \arguments{ \item{n}{an integer giving the number of tips in the tree.} @@ -16,6 +17,7 @@ rcoal(n, tip.label = NULL, br = rexp, ...) (\code{rtree}) or the coalescence times (\code{rcoal}), or \code{NULL} to give no branch lengths in the tree.} \item{...}{further argument(s) to be passed to \code{br}.} + \item{N}{an integer giving the number of trees to generate.} } \description{ These functions generate trees by splitting randomly the edges @@ -31,6 +33,13 @@ rcoal(n, tip.label = NULL, br = rexp, ...) \code{runif}. In \code{rcoal} \code{rexp} is used to generate the inter-node distances. If further arguments are passed to \code{br}, they need to be tagged (e.g., \code{min = 0, max = 10}). + + \code{rmtree} calls successively \code{rmtree} and set the class of + the returned object appropriately. +} +\value{ + An object of class \code{"phylo"} or of class \code{"multiPhylo"} in + the case of \code{rmtree}. } \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}} \examples{ -- 2.39.2