[Vegan-commits] r2442 - in pkg/vegan: man tests/Examples

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Feb 17 08:05:38 CET 2013


Author: jarioksa
Date: 2013-02-17 08:05:38 +0100 (Sun, 17 Feb 2013)
New Revision: 2442

Modified:
   pkg/vegan/man/vegemite.Rd
   pkg/vegan/tests/Examples/vegan-Ex.Rout.save
Log:
upgdate vegemite.Rd for tabasco

Modified: pkg/vegan/man/vegemite.Rd
===================================================================
--- pkg/vegan/man/vegemite.Rd	2013-02-15 10:23:18 UTC (rev 2441)
+++ pkg/vegan/man/vegemite.Rd	2013-02-17 07:05:38 UTC (rev 2442)
@@ -5,12 +5,13 @@
 
 \title{Display Compact Ordered Community Tables }
 \description{
-  The functions display compact community tables.  Function
-  \code{vegemite} prints text tables where species are rows, and each
-  site takes only one column without spaces.  Function \code{tabasco}
-  provides interface for \code{\link{heatmap}} for a colour map of
-  the data. The community table can be ordered by explicit indexing,
-  by environmental variables or results from an ordination or cluster
+  Functions \code{vegemite} and \code{tabasco} display compact
+  community tables.  Function \code{vegemite} prints text tables where
+  species are rows, and each site takes only one column without
+  spaces.  Function \code{tabasco} provides interface for
+  \code{\link{heatmap}} for a colour \code{\link{image}} of the
+  data. The community table can be ordered by explicit indexing, by
+  environmental variables or results from an ordination or cluster
   analysis.
 }
 \usage{
@@ -22,78 +23,85 @@
 }
 
 \arguments{
-  \item{x}{Vegetation data. }
+  \item{x}{Community data. }
   \item{use}{Either a vector, or an object from \code{cca},
     \code{decorana} \emph{etc.} or \code{hclust} or a
     \code{\link{dendrogram}} for ordering sites and species.} 
-  \item{sp.ind}{Species indices. In \code{tabasco}, this can also be an
-    \code{\link{hclust}} tree or a \code{\link{dendrogram}}. }
-  \item{site.ind}{Site indices. }
+  \item{sp.ind, site.ind}{Species and site indices. In \code{tabasco},
+    these can also be \code{\link{hclust}} tree,
+    \code{\link[cluster]{agnes}} clusterings or
+    \code{\link{dendrogram}}s. }
   \item{zero}{Character used for zeros. }
   \item{select}{Select a subset of sites.  This can be a logical vector
     (\code{TRUE} for selected sites), or a vector of indices of selected
     sites.  The order of indices does not influence results, but you
     must specify \code{use} or \code{site.ind} to reorder sites.
   }
-  \item{Rowv, Colv}{Reorder dendrograms for the rows (sites) or columns
-    (species) of \code{x}.  If the arguments are \code{TRUE}, row
+  \item{Rowv, Colv}{Re-order dendrograms for the rows (sites) or
+    columns (species) of \code{x}.  If the \code{Rowv = TRUE}, row
     dendrograms are ordered by the first axis of correspondence
-    analysis, and column dendrograms by the weighted average
-    (\code{\link{wascores}}) of the order in the row.  Alternatively
-    these can be vectors that are used to reorder the dendrogram. }
+    analysis, and when \code{Colv = TRUE} column dendrograms by the
+    weighted average (\code{\link{wascores}}) of the row order.
+    Alternatively, the arguments can be vectors that are used to
+    reorder the dendrogram. }
   \item{scale}{Cover scale used (can be abbreviated).}
   \item{maxabund}{Maximum abundance used with \code{scale = "log"}.
     Data maximum in the \code{select}ed subset will be used if this is
     missing.}
-  \item{...}{Arguments passed to \code{coverscale} (i.e., \code{maxabund}) in
+  \item{\dots}{Arguments passed to \code{coverscale} (i.e., \code{maxabund}) in
     \code{vegemite} and to \code{\link{heatmap}} in \code{tabasco}.}
 }
 \details{
   The function \code{vegemite} prints a traditional community table.
-  Unlike in ordinary data matrices, species are used as rows and sites
-  as columns.  The table is printed in compact form:  only one character
+  The display is transposed, so that species are in rows and sites in
+  columns.  The table is printed in compact form: only one character
   can be used for abundance, and there are no spaces between
   columns. Species with no occurrences are dropped from the table.
 
   Function \code{tabasco} produces a similar table as \code{vegemite}
-  using \code{\link{heatmap}}, where abundances are coded by heatmap
-  colours.
+  using \code{\link{heatmap}}, where abundances are coded by
+  colours. The function can also display dendrograms for sites
+  (columns) or species if these are given as an argument (\code{use}
+  for sites, \code{sp.ind} for species).
 
-  The parameter \code{use} can be a vector or an object from
-  \code{\link{hclust}}, a \code{\link{dendrogram}} or any ordination
-  result recognized by \code{\link{scores}} (all ordination methods in
-  \pkg{vegan} and some of those not in \pkg{vegan}). The
-  \code{\link{hclust}} and \code{\link{dendrogram}} must be for
-  sites. The dendrogram is displayed above the sites in
-  \code{tabasco}.  No dendrogram for species is displayed, except when
-  given in \code{sp.ind}.
+  The parameter \code{use} will be used to re-order output. The
+  \code{use} can be a vector or an object from \code{\link{hclust}} or
+  \code{\link[cluster]{agnes}}, a \code{\link{dendrogram}} or any
+  ordination result recognized by \code{\link{scores}} (all ordination
+  methods in \pkg{vegan} and some of those not in \pkg{vegan}). The
+  \code{\link{hclust}}, \code{\link[cluster]{agnes}} and
+  \code{\link{dendrogram}} must be for sites. The dendrogram is
+  displayed above the sites in \code{tabasco}, but is not shown in
+  \code{vegemite}.  No dendrogram for species is displayed, except
+  when given in \code{sp.ind}.
 
-  If \code{use} is a vector, it is used
-  for ordering sites.  If \code{use} is an object from ordination, both
-  sites and species are arranged by the first axis.  
-  When \code{use} is an
-  object from \code{\link{hclust}} or a \code{\link{dendrogram}}, the
-  sites are ordered similarly
-  as in the cluster dendrogram.
-  If ordination methods provide species scores, these are used for
-  ordering species.  In all cases where species scores are missing,
-  species are ordered by their weighted averages (\code{\link{wascores}})
-  on site scores. There is no natural, unique ordering in hierarchic
-  clustering, but in some cases species are still nicely ordered (please
-  note that you can \code{\link{reorder.dendrogram}} to have such a
-  natural order).
+  If \code{use} is a vector, it is used for ordering sites.  If
+  \code{use} is an object from ordination, both sites and species are
+  arranged by the first axis (provided that results are available both
+  also for species).  When \code{use} is an object from
+  \code{\link{hclust}}, \code{\link[cluster]{agnes}} or a
+  \code{\link{dendrogram}}, the sites are ordered similarly as in the
+  cluster dendrogram.  Function \code{tabasco} re-orders the
+  dendrogram if \code{Rowv = TRUE} or \code{Rowv} is a vector. Such
+  re-ordering is not available for \code{vegemite}, but it can be done
+  by hand using \code{\link{reorder.dendrogram}}.  In all cases where
+  species scores are missing, species are ordered by their weighted
+  averages (\code{\link{wascores}}) on site order.
 
   Species and sites can be ordered explicitly giving their indices or
   names in parameters \code{sp.ind} and \code{site.ind}.  If these are
-  given, they take precedence over \code{use}. A subset of sites can be
-  displayed using argument \code{select}, but this cannot be used to
-  order sites, but you still must give \code{use} or \code{site.ind}.
-  However, \code{tabasco} makes two exceptions: \code{site.ind} and
-  \code{select} cannot be used when \code{use} is an
-  \code{\link{hclust}} tree or a \code{\link{dendrogram}}. In addition,
-  the \code{sp.ind} can also be an \code{\link{hclust}} tree or a
-  \code{\link{dendrogram}}, and in that case the dendrogram is plotted
-  on the left side of the \code{\link{heatmap}}.
+  given, they take precedence over \code{use}. A subset of sites can
+  be displayed using argument \code{select}, but this cannot be used
+  to order sites, but you still must give \code{use} or
+  \code{site.ind}.  However, \code{tabasco} makes two exceptions:
+  \code{site.ind} and \code{select} cannot be used when \code{use} is
+  a dendrogram (clustering result). In addition, the \code{sp.ind} can
+  be an \code{\link{hclust}} tree, \code{\link[cluster]{agnes}}
+  clustering or a \code{\link{dendrogram}}, and in that case the
+  dendrogram is plotted on the left side of the
+  \code{\link{heatmap}}. Phylogenetic trees cannot be directly used,
+  \code{\link[ape]{as.hclust.phylo}} (package \pkg{ape}) can transform
+  these to \code{\link{hclust}} trees. 
 
   If \code{scale} is given, \code{vegemite} calls
   \code{coverscale} to transform percent cover
@@ -117,11 +125,12 @@
   10 with \code{X} and positive values below 1 with \code{+}. 
 }
 \value{
-  The functions are used mainly to display a table, but it returns
+  The functions are used mainly to display a table, but they return
   (invisibly) a list
   with items:
   \item{species}{Ordered species indices}
   \item{sites}{Ordered site indices}
+ 
   These items can be used as arguments \code{sp.ind} and \code{site.ind}
   to reproduce the table. In addition to the proper table, \code{vegemite}
   prints the numbers of species and sites and the name of the used cover
@@ -137,9 +146,9 @@
 
 \seealso{\code{\link{cut}} and \code{\link{approx}} for making your
   own \sQuote{cover scales} for \code{vegemite}.  Function
-  \code{tabasco} is based on \code{\link{heatmap}}. Both functions
-  order species with weighted averages using \code{\link{wascores}}.
-  }
+  \code{tabasco} is based on \code{\link{heatmap}} which in turn is
+  based on \code{\link{image}}. Both functions order species with
+  weighted averages using \code{\link{wascores}}.  }
 
 \note{   
 
@@ -160,18 +169,31 @@
 clus <- hclust(vegdist(varespec))
 cl <- cutree(clus, 3)
 sel <- vegemite(varespec, use=dca, select = cl == 3, scale="Br")
-# Re-create previous
+## Re-create previous
 vegemite(varespec, sp=sel$sp, site=sel$site, scale="Hult")
+## Re-order clusters by ordination
+clus <- as.dendrogram(clus)
+clus <- reorder(clus, scores(dca, choices=1, display="sites"), agglo.FUN = mean)
+vegemite(varespec, clus, scale = "Hult")
 
 ## Abundance values have such a wide range that they must be rescaled
 ## or all abundances will not be shown in tabasco
-tabasco(decostand(varespec, "log"), clus)
-## reorder dendrogram by the first DCA axis
-clus <- as.dendrogram(clus)
-clus <- reorder(clus, scores(dca, choices=1, display="sites"))
-tabasco(decostand(varespec, "log"), clus)
+tabasco(decostand(varespec, "log"), dca)
 
+## Classification trees for species
+data(dune, dune.taxon)
+taxontree <- hclust(taxa2dist(dune.taxon))
+plotree <- hclust(vegdist(dune), "average")
+## Automatic reordering of clusters
+tabasco(dune, plotree, sp.ind = taxontree)
+## No reordering of taxonomy
+tabasco(dune, plotree, sp.ind = taxontree, Colv = FALSE)
+## Species cluster: most dissimilarity indices do a bad job when
+## comparing rare and common species, but Raup-Crick makes sense
+sptree <- hclust(vegdist(t(dune), "raup"), "average")
+tabasco(dune, plotree, sptree)
 }
-\keyword{ print }
-\keyword{ manip }
+\keyword{print}
+\keyword{manip}
+\keyword{hplot}
 

Modified: pkg/vegan/tests/Examples/vegan-Ex.Rout.save
===================================================================
--- pkg/vegan/tests/Examples/vegan-Ex.Rout.save	2013-02-15 10:23:18 UTC (rev 2441)
+++ pkg/vegan/tests/Examples/vegan-Ex.Rout.save	2013-02-17 07:05:38 UTC (rev 2442)
@@ -161,7 +161,7 @@
 
 Formula:
 y ~ poly(x1, 1) + poly(x2, 1)
-<environment: 0x10245b5b8>
+<environment: 0x10245a8e8>
 Total model degrees of freedom 3 
 
 GCV score: 0.04278782
@@ -4908,7 +4908,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x10ac51d18>
+<environment: 0x10a9cc178>
 
 Estimated degrees of freedom:
 6.45  total = 7.45 
@@ -4924,7 +4924,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x109d00ed8>
+<environment: 0x10ac80208>
 
 Estimated degrees of freedom:
 6.12  total = 7.12 
@@ -5092,7 +5092,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x109cb80e8>
+<environment: 0x107e94708>
 
 Estimated degrees of freedom:
 8.93  total = 9.93 
@@ -5105,7 +5105,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x10adbb588>
+<environment: 0x10851f590>
 
 Estimated degrees of freedom:
 7.75  total = 8.75 
@@ -5118,7 +5118,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x108d98b90>
+<environment: 0x109432720>
 
 Estimated degrees of freedom:
 8.9  total = 9.9 
@@ -7692,7 +7692,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x10b44d008>
+<environment: 0x10a8a53c8>
 
 Estimated degrees of freedom:
 2  total = 3 
@@ -7941,7 +7941,7 @@
   sites species 
       5      37 
 scale:  Braun.Blanquet 
-> # Re-create previous
+> ## Re-create previous
 > vegemite(varespec, sp=sel$sp, site=sel$site, scale="Hult")
               
           1 12
@@ -7986,17 +7986,78 @@
   sites species 
       5      37 
 scale:  Hult 
+> ## Re-order clusters by ordination
+> clus <- as.dendrogram(clus)
+> clus <- reorder(clus, scores(dca, choices=1, display="sites"), agglo.FUN = mean)
+> vegemite(varespec, clus, scale = "Hult")
+                                 
+           1   111  1211221212222
+         431567380922149306254578
+ Cet.niv 21.111.111....11........
+ Cla.ama .1.1...1................
+ Ste.sp  111211111....111.1.111.1
+ Pol.pil ..111..1......111..1....
+ Dip.mon .1...111.1...........1..
+ Cla.phy ..1.....11...1..........
+ Cla.ran 344544332133111223121121
+ Cla.cer 1.........1..........1..
+ Cla.ste 454121215555213111111.1.
+ Cla.arb 322344331111132222121111
+ Vac.uli 11...2.1........1.1..111
+ Cal.vul 111.1.311.11.1..11111...
+ Ich.eri ...1.1.......1...1......
+ Cla.sp  1...1.11.1......111..11.
+ Cla.coc 1111111111...1111111.1.1
+ Pin.syl 1.111.1111111111111111.1
+ Cla.chl .1..111.111.1.11..1.1...
+ Cet.isl 1.1...1.11.111...1.111.1
+ Cla.fim 11.11111111111111111.111
+ Pel.aph ..1...11.......1.....11.
+ Cet.eri 11.1111111...1..111111..
+ Cla.gra 11111111.111111111111111
+ Poh.nut 111..11111.1111111111.11
+ Pti.cil .11.1.11.11.2.11.1111111
+ Bar.lyc ......1.....1.11......1.
+ Cla.cor 111111111111111111111111
+ Vac.vit 113122132323412331223232
+ Cla.cri 111111111111111111111111
+ Emp.nig 111111122122312322111231
+ Cla.bot ......1.....1.111...1.11
+ Bet.pub ............1.....1..1..
+ Cla.unc 111111111111131111112111
+ Cla.def 11.111111111111111111111
+ Dic.pol ..11.1..11..1.1111.11..1
+ Pol.com ............111......11.
+ Led.pal ......1.....1.....1...11
+ Pol.jun 1.111111111.111111.112.1
+ Dic.fus 11111111111112111442.211
+ Ple.sch 113111111111123333444455
+ Vac.myr ......1..1..311..111..13
+ Nep.arc .1...1.1........1....1..
+ Dic.sp  ......1....11...111133.1
+ Des.fle 1....1......1.1...1..111
+ Hyl.spl ................1....122
+  sites species 
+     24      44 
+scale:  Hult 
 > 
 > ## Abundance values have such a wide range that they must be rescaled
 > ## or all abundances will not be shown in tabasco
-> tabasco(decostand(varespec, "log"), clus)
+> tabasco(decostand(varespec, "log"), dca)
 Warning: non-integer data: divided by smallest positive value
-> ## reorder dendrogram by the first DCA axis
-> clus <- as.dendrogram(clus)
-> clus <- reorder(clus, scores(dca, choices=1, display="sites"))
-> tabasco(decostand(varespec, "log"), clus)
-Warning: non-integer data: divided by smallest positive value
 > 
+> ## Classification trees for species
+> data(dune, dune.taxon)
+> taxontree <- hclust(taxa2dist(dune.taxon))
+> plotree <- hclust(vegdist(dune), "average")
+> ## Automatic reordering of clusters
+> tabasco(dune, plotree, sp.ind = taxontree)
+> ## No reordering of taxonomy
+> tabasco(dune, plotree, sp.ind = taxontree, Colv = FALSE)
+> ## Species cluster: most dissimilarity indices do a bad job when
+> ## comparing rare and common species, but Raup-Crick makes sense
+> sptree <- hclust(vegdist(t(dune), "raup"), "average")
+> tabasco(dune, plotree, sptree)
 > 
 > 
 > 
@@ -8183,7 +8244,7 @@
 > ### * <FOOTER>
 > ###
 > cat("Time elapsed: ", proc.time() - get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed:  104.54 1.972 107.111 0 0 
+Time elapsed:  82.333 1.542 86.731 0 0 
 > grDevices::dev.off()
 null device 
           1 



More information about the Vegan-commits mailing list