[Vegan-commits] r2440 - pkg/vegan/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Feb 15 09:37:02 CET 2013


Author: jarioksa
Date: 2013-02-15 09:37:02 +0100 (Fri, 15 Feb 2013)
New Revision: 2440

Modified:
   pkg/vegan/R/tabasco.R
Log:
combine dendrogram handling in one place

Modified: pkg/vegan/R/tabasco.R
===================================================================
--- pkg/vegan/R/tabasco.R	2013-02-14 17:32:42 UTC (rev 2439)
+++ pkg/vegan/R/tabasco.R	2013-02-15 08:37:02 UTC (rev 2440)
@@ -16,19 +16,12 @@
             if (is.null(sp.ind)) 
                 sp.ind <- order(wascores(use, x))
         }
-        else if (inherits(use, "hclust")) {
-            if (!is.null(site.ind))
-                stop("'site.ind' cannot be used with 'hclust' tree ")
-            site.ind <- use$order
-            if (is.null(sp.ind)) 
-                sp.ind <- order(wascores(order(site.ind), x))
-            pltree <- as.dendrogram(use)
-        }
-        else if (inherits(use, c("dendrogram", "twins"))) {
+        else if (inherits(use, c("dendrogram", "hclust", "twins"))) {
             if (inherits(use, "twins")) {
                 require(cluster) || stop("package cluster needed to handle 'use'")
-                use <- as.dendrogram(use)
             }
+            if (!inherits(use, "dendrogram"))
+                use <- as.dendrogram(use)
             if (!is.null(site.ind))
                 stop("'site.ind' cannot be used with dendrogram")
             site.ind <- seq_len(nrow(x))



More information about the Vegan-commits mailing list