[Vegan-commits] r2438 - in pkg/vegan: R inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Feb 13 20:59:53 CET 2013


Author: jarioksa
Date: 2013-02-13 20:59:53 +0100 (Wed, 13 Feb 2013)
New Revision: 2438

Modified:
   pkg/vegan/R/tabasco.R
   pkg/vegan/R/vegemite.R
   pkg/vegan/inst/ChangeLog
Log:
we need to require() packages for method functions, and we don't want to add picante to vegan dependencies

Modified: pkg/vegan/R/tabasco.R
===================================================================
--- pkg/vegan/R/tabasco.R	2013-02-13 17:26:46 UTC (rev 2437)
+++ pkg/vegan/R/tabasco.R	2013-02-13 19:59:53 UTC (rev 2438)
@@ -25,8 +25,10 @@
             Colv <- as.dendrogram(use)
         }
         else if (inherits(use, c("dendrogram", "twins"))) {
-            if (!inherits(use, "dendrogram"))
+            if (inherits(use, "twins")) {
+                require(cluster) || stop("package cluster needed to handle 'use'")
                 use <- as.dendrogram(use)
+            }
             if (!is.null(site.ind))
                 stop("'dendrogram' cannot be 'use'd with 'site.ind'")
             site.ind <- seq_len(nrow(x))
@@ -55,10 +57,9 @@
         }
     }
     ## see if sp.ind is a dendrogram or hclust tree
-    if (inherits(sp.ind, c("hclust", "dendrogram", "twins", "phylo"))) {
-        ## phylo trees are from picante: they only have as.hclust method
-        if (inherits(sp.ind, "phylo"))
-            sp.ind <- as.hclust(sp.ind)
+    if (inherits(sp.ind, c("hclust", "dendrogram", "twins"))) {
+        if (inherits(sp.ind, "twins"))
+            require("cluster") || stop("package cluster needed to handle 'sp.ind'")
         if (!inherits(sp.ind, "dendrogram"))
             sp.ind <- as.dendrogram(sp.ind)
         Rowv <- sp.ind

Modified: pkg/vegan/R/vegemite.R
===================================================================
--- pkg/vegan/R/vegemite.R	2013-02-13 17:26:46 UTC (rev 2437)
+++ pkg/vegan/R/vegemite.R	2013-02-13 19:59:53 UTC (rev 2438)
@@ -1,4 +1,4 @@
-"vegemite" <-
+`vegemite` <-
     function (x, use, scale, sp.ind = NULL, site.ind = NULL, zero = ".", 
               select, ...) 
 {
@@ -10,8 +10,10 @@
                 sp.ind <- order(wascores(use, x))
         }
         else if (inherits(use, c("hclust", "twins"))) {
-            if (!inherits(use, "hclust"))
+            if (inherits(use, "twins")) {
+                require(cluster) || stop("package cluster needed for 'use'")
                 use <- as.hclust(use)
+            }
             if (is.null(site.ind)) 
                 site.ind <- use$order
             if (is.null(sp.ind)) 

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2013-02-13 17:26:46 UTC (rev 2437)
+++ pkg/vegan/inst/ChangeLog	2013-02-13 19:59:53 UTC (rev 2438)
@@ -9,8 +9,7 @@
 
 	* tabasco: a sister function of vegemite() to display a compact
 	community table using heatmap(). Both vegemite() and tabasco() can
-	handle cluster::agnes() trees, and tabasco() can handle
-	picante::phylo() trees for species.
+	handle cluster::agnes() trees.
 
 	* wcmdscale: return a full "wcmdscale" object if any argument is
 	set to non-default value. This also implies that if weights 'w'



More information about the Vegan-commits mailing list