]> git.donarmstrong.com Git - ape.git/commitdiff
new function rmtree
authorparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Tue, 8 Jan 2008 11:57:26 +0000 (11:57 +0000)
committerparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Tue, 8 Jan 2008 11:57:26 +0000 (11:57 +0000)
git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@12 6e262413-ae40-0410-9e79-b911bd7a66b7

Changes
DESCRIPTION
R/rtree.R
man/rtree.Rd

diff --git a/Changes b/Changes
index a145133e067d9ad63a1f1c209a3855c4d9aca417..adeee977386900bfebf5c861fd9b51441f716f17 100644 (file)
--- 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
 
 
index fb34c8e93e76ab8ae01cf75038a95e2cbc33c7ee..60c2368dc5d30037cf70390ea719155cd97880f2 100644 (file)
@@ -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,
index 2e1a8a4778ba11d3b35859da41658e48f360b7a3..6d0172c1ef8b5029739dbd91eb7d027064f1e37f 100644 (file)
--- 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
+}
index 96116f97babc93425b814f0bdcea06f70b8631fa..63cbf79e5f8a2c1f74602c0845be3140bb2f5fdc 100644 (file)
@@ -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{