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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Aug 17 15:21:42 CEST 2009


Author: francois
Date: 2009-08-17 15:21:42 +0200 (Mon, 17 Aug 2009)
New Revision: 465

Modified:
   branches/fm-branch/R/checkdata.R
Log:
Remove buggy warning message in case of adding data to a phylo4d with no internal node labels

Modified: branches/fm-branch/R/checkdata.R
===================================================================
--- branches/fm-branch/R/checkdata.R	2009-08-17 00:52:47 UTC (rev 464)
+++ branches/fm-branch/R/checkdata.R	2009-08-17 13:21:42 UTC (rev 465)
@@ -199,10 +199,20 @@
 
         ## Check differences
         extra <- names(ndDt[is.na(ndDt)])
-        mssng <- labels(phy, which)[! labels(phy, which) %in% names(ndDt)]
+        mssng <- nodeId(phy, which)[! nodeId(phy, which) %in% ndDt]
 
         if(length(mssng) > 0 && missing.data != "OK") {
             msg <- "The following nodes are not found in the dataset: "
+
+            ## provides label if it exists and node number otherwise
+            mssng <- sapply(mssng, function(m) {
+                m <- getNode(phy, m)
+                if (is.na(names(m)) || is.null(names(m)))
+                    m
+                else
+                    names(m)
+            })
+
             msg <- paste(msg, paste(mssng, collapse=", "))
             switch(missing.data,
                    warn = warning(msg),



More information about the Phylobase-commits mailing list