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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jan 10 12:03:26 CET 2014


Author: jarioksa
Date: 2014-01-10 12:03:26 +0100 (Fri, 10 Jan 2014)
New Revision: 2830

Modified:
   pkg/vegan/R/treedist.R
   pkg/vegan/R/treedive.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/treedive.Rd
Log:
default now match.force=TRUE and treedive can be silenced

Modified: pkg/vegan/R/treedist.R
===================================================================
--- pkg/vegan/R/treedist.R	2014-01-08 09:33:40 UTC (rev 2829)
+++ pkg/vegan/R/treedist.R	2014-01-10 11:03:26 UTC (rev 2830)
@@ -1,5 +1,5 @@
 `treedist` <-
-    function(x, tree, relative = TRUE,  match.force = FALSE, ...)
+    function(x, tree, relative = TRUE,  match.force = TRUE, ...)
 {
     n <- nrow(x)
     ABJ <- matrix(0, n , n)

Modified: pkg/vegan/R/treedive.R
===================================================================
--- pkg/vegan/R/treedive.R	2014-01-08 09:33:40 UTC (rev 2829)
+++ pkg/vegan/R/treedive.R	2014-01-10 11:03:26 UTC (rev 2830)
@@ -1,17 +1,17 @@
 `treedive` <-
-    function(comm, tree, match.force = FALSE)
+    function(comm, tree, match.force = TRUE, verbose = TRUE)
 {
     if (!inherits(tree, c("hclust", "spantree")))
         stop("'clus' must be an 'hclust' or 'spantree' result object")
     m <- as.matrix(cophenetic(tree))
     ## Check tree/comm match by names
     if (match.force || ncol(comm) != ncol(m)) {
-        if (match.force)
+        if (match.force && verbose)
             message("Forced matching of 'tree' labels and 'comm' names")
-        else
+        else if (verbose)
             message("Dimensions do not match between 'comm' and 'tree'")
         fnd <- colnames(comm) %in% tree$labels
-        if (!all(fnd)) {
+        if (!all(fnd) && verbose) {
             warning("not all names of 'comm' found in 'tree'")
             comm <- comm[, fnd]
         }

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2014-01-08 09:33:40 UTC (rev 2829)
+++ pkg/vegan/inst/ChangeLog	2014-01-10 11:03:26 UTC (rev 2830)
@@ -20,6 +20,10 @@
 	with three points was reported by Paul Bacquet (Louvain,
 	Belgium). 
 
+	* treedive, treedist: default is now match.force = TRUE, and
+	treedive() gained new argument 'verbose' to turn of most messages
+	-- which is practical in oecosimu().
+
 	* BCI: names checked after http://www.theplantlist.org, but kept
 	the old (alphabetic) order of species. The changes are: Abarema
 	macradenium -> A. macradenia, Apeiba aspera -> A. glabra,

Modified: pkg/vegan/man/treedive.Rd
===================================================================
--- pkg/vegan/man/treedive.Rd	2014-01-08 09:33:40 UTC (rev 2829)
+++ pkg/vegan/man/treedive.Rd	2014-01-10 11:03:26 UTC (rev 2830)
@@ -3,7 +3,7 @@
 \alias{treeheight}
 \alias{treedist}  
 
-\title{ Functional Diversity and Community Distances from Species Trees}
+\title{Functional Diversity and Community Distances from Species Trees}
 
 \description{ Functional diversity is defined as the total branch
   length in a trait dendrogram connecting all species, but excluding
@@ -12,9 +12,9 @@
   combining two sites.  }
 
 \usage{
-treedive(comm, tree, match.force = FALSE)
+treedive(comm, tree, match.force = TRUE, verbose = TRUE)
 treeheight(tree)
-treedist(x, tree, relative = TRUE, match.force = FALSE, ...)
+treedist(x, tree, relative = TRUE, match.force = TRUE, ...)
 }
 
 \arguments{
@@ -26,6 +26,7 @@
     matching only happens when dimensions differ (with a warning or
     message). The order of data must match to the order in \code{tree}
     if matching by names is not done.}
+  \item{verbose}{Print diagnostic messages and warnings.}
   \item{relative}{Use distances relative to the height of combined tree.}
   \item{\dots}{Other arguments passed to functions (ignored).}
 }
@@ -35,7 +36,8 @@
   dendrogram that can be coerced to a correct type using
   \code{\link{as.hclust}}. When applied to a clustering of species
   traits, this is a measure of functional diversity (Petchey and Gaston
-  2002, 2006).
+  2002, 2006), and when applied to phylogenetic trees this is
+  phylogenetic diversity.
 
   Function \code{treedive} finds the \code{treeheight} for each site
   (row) of a community matrix. The function uses a subset of
@@ -45,7 +47,7 @@
   calculating \code{\link{cophenetic}} distances from the input
   dendrogram, then reconstructing the dendrogram for the subset of the
   cophenetic distance matrix for species occurring in each
-  site. Diversity is 0 for one spcies, and \code{NA} for empty
+  site. Diversity is 0 for one species, and \code{NA} for empty
   communities.
 
   Function \code{treedist} finds the dissimilarities among
@@ -64,15 +66,17 @@
   index attains its maximum value \eqn{2}. The dissimilarity is zero
   from a combined zero-height tree.
 
-  The functions need a dendrogram of species traits as an input. If
-  species traits contain \code{\link{factor}} or \code{\link{ordered}}
-  factor variables, it is recommended to use Gower distances for mixed
-  data (function \code{\link[cluster]{daisy}} in package \pkg{cluster}),
-  and usually the recommended clustering method is UPGMA 
-  (\code{method = "average"} in function \code{\link{hclust}}) 
-  (Podani and Schmera 2006).
+  The functions need a dendrogram of species traits or phylogenies as an
+  input. If species traits contain \code{\link{factor}} or
+  \code{\link{ordered}} factor variables, it is recommended to use Gower
+  distances for mixed data (function \code{\link[cluster]{daisy}} in
+  package \pkg{cluster}), and usually the recommended clustering method
+  is UPGMA (\code{method = "average"} in function \code{\link{hclust}})
+  (Podani and Schmera 2006). Phylogenetic trees can be changed into
+  dendrograms using \code{\link[ape]{as.hclust.phylo}} (package
+  \pkg{ape})
 
-  It is possible to analyse the non-randomness of functional diversity
+  It is possible to analyse the non-randomness of tree diversity
   using \code{\link{oecosimu}}. This needs specifying an adequate Null
   model, and the results will change with this choice.
 }



More information about the Vegan-commits mailing list