[Phylobase-commits] r591 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Aug 26 02:37:50 CEST 2009


Author: regetz
Date: 2009-08-26 02:37:50 +0200 (Wed, 26 Aug 2009)
New Revision: 591

Modified:
   pkg/R/class-phylo4d.R
Log:
streamlined phylo4d('phylo4') method by using implicit coerce method


Modified: pkg/R/class-phylo4d.R
===================================================================
--- pkg/R/class-phylo4d.R	2009-08-26 00:30:25 UTC (rev 590)
+++ pkg/R/class-phylo4d.R	2009-08-26 00:37:50 UTC (rev 591)
@@ -157,22 +157,14 @@
                    metadata = list(),
                    ...) {
 
-    ## Creating new phylo4d object
-    res <- new("phylo4d")
-    res at edge <- x at edge
-    res at edge.length <- x at edge.length
-    res at Nnode <- x at Nnode
-    res at tip.label <- x at tip.label
-    res at node.label <- x at node.label
-    res at edge.label <- x at edge.label
-    res at order <- x at order
-
-    ## taking care of the data
+    ## prepare the data
     tmpData <- .phylo4Data(x=x, tip.data=tip.data, node.data=node.data,
                            all.data=all.data, match.data=match.data,
                            merge.data=merge.data,
                            rownamesAsLabels=rownamesAsLabels, ...)
 
+    ## coerce to phylo4d and add data/metadata
+    res <- as(x, "phylo4d")
     res at tip.data <- tmpData$tip.data
     res at node.data <- tmpData$node.data
     res at metadata <- metadata



More information about the Phylobase-commits mailing list