[Phylobase-commits] r464 - branches/fm-branch/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Aug 17 02:52:53 CEST 2009


Author: francois
Date: 2009-08-17 02:52:47 +0200 (Mon, 17 Aug 2009)
New Revision: 464

Modified:
   branches/fm-branch/R/setAs-Methods.R
Log:
Added checkPhylo4 before converting phylo4d to data.frame and phylo4 to phylo

Modified: branches/fm-branch/R/setAs-Methods.R
===================================================================
--- branches/fm-branch/R/setAs-Methods.R	2009-08-14 11:14:12 UTC (rev 463)
+++ branches/fm-branch/R/setAs-Methods.R	2009-08-17 00:52:47 UTC (rev 464)
@@ -69,6 +69,10 @@
 ## })
 
 setAs("phylo4", "phylo", function(from, to) {
+
+    if(is.character(checkval <- checkPhylo4(from)))
+        stop(checkval)
+    
     if (inherits(from, "phylo4d"))
         warning("losing data while coercing phylo4d to phylo")
     brlen <- unname(from at edge.length)
@@ -173,6 +177,9 @@
 
 setAs(from = "phylo4d", to = "data.frame", function(from) {
 
+    if(is.character(checkval <- checkPhylo4(from)))
+        stop(checkval)
+
     tree <- extractTree(from)
     ## Convert to data.frame
     tDf <- as(tree, "data.frame")



More information about the Phylobase-commits mailing list