[Phylobase-commits] r148 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Mar 8 01:07:44 CET 2008


Author: pdc
Date: 2008-03-08 01:07:44 +0100 (Sat, 08 Mar 2008)
New Revision: 148

Modified:
   pkg/R/class-multiphylo4.R
   pkg/R/multiphylo.R
Log:
Move multiphylo class definitions

Modified: pkg/R/class-multiphylo4.R
===================================================================
--- pkg/R/class-multiphylo4.R	2008-03-08 00:01:37 UTC (rev 147)
+++ pkg/R/class-multiphylo4.R	2008-03-08 00:07:44 UTC (rev 148)
@@ -0,0 +1,8 @@
+## classes for holding multiple tree objects
+
+setClass("multiPhylo4", representation(phylolist = "list", 
+    tree.names = "character"), prototype = list(phylolist = list(), 
+    tree.names = character(0)))
+
+setClass("multiPhylo4d", representation(tip.data = "data.frame"), 
+    contains = "multiPhylo4")

Modified: pkg/R/multiphylo.R
===================================================================
--- pkg/R/multiphylo.R	2008-03-08 00:01:37 UTC (rev 147)
+++ pkg/R/multiphylo.R	2008-03-08 00:07:44 UTC (rev 148)
@@ -1,30 +1,22 @@
-require(methods)
-require(ape)
-
-setClass("multiPhylo4",
-         representation(phylolist="list",
-                        tree.names="character"),
-         prototype = list(phylolist=list(),
-           tree.names=character(0)))
-
-setClass("multiPhylo4d",
-         representation(tip.data="data.frame"),
-         contains="multiPhylo4")
-
-
 ## function to bind trees together into a multi-tree object
-tbind <- function(...,check_data=FALSE) {
+
+tbind <- function(..., check_data = FALSE) {
     L <- as.list(...)
-    treeclasses <- c("multiPhylo4d","multiPhylo4","phylo4","phylo4d")
-    tdataclasses <- c("multiPhylo4d","phylo4d")
-    classes <- sapply(L,class)
-    if (!all(classes %in% treeclasses)) stop("all elements must be trees or multitrees")
-    if (!all(classes %in% tdataclasses)) {
-        if (any(classes %in% tdataclasses)) warning("not all elements contain data: data discarded")
+    treeclasses <- c("multiPhylo4d", "multiPhylo4", "phylo4", 
+        "phylo4d")
+    tdataclasses <- c("multiPhylo4d", "phylo4d")
+    classes <- sapply(L, class)
+    if (!all(classes %in% treeclasses)) 
+        stop("all elements must be trees or multitrees")
         ## decompose multi-trees into lists
         ## bind list into multi-tree
-    } else {
-        ## check: all data identical?
-        ## decompose multi-trees into lists
+    if (!all(classes %in% tdataclasses)) {
+        if (any(classes %in% tdataclasses)) 
+            warning("not all elements contain data: data discarded")
+    ## check: all data identical?
+    ## decompose multi-trees into lists
     }
+    else {
+    }
 }
+



More information about the Phylobase-commits mailing list