diff mbox

[3/3] gnu: Add r-vegan.

Message ID 1466081273-15127-4-git-send-email-donttrustben@gmail.com
State New
Headers show

Commit Message

Ben Woodcroft June 16, 2016, 12:47 p.m. UTC
* gnu/packages/bioinformatics.scm (r-vegan): New variable.
* gnu/packages/patches/vegan-revert-test-deletion.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                       |     1 +
 gnu/packages/bioinformatics.scm                    |    30 +
 .../patches/vegan-revert-test-deletion.patch       | 12227 +++++++++++++++++++
 3 files changed, 12258 insertions(+)
 create mode 100644 gnu/packages/patches/vegan-revert-test-deletion.patch

Comments

Leo Famulari June 18, 2016, 12:56 a.m. UTC | #1
On Thu, Jun 16, 2016 at 10:47:53PM +1000, Ben Woodcroft wrote:
> * gnu/packages/bioinformatics.scm (r-vegan): New variable.
> * gnu/packages/patches/vegan-revert-test-deletion.patch: New file.

This patch is 460K uncompressed. gzip reduces it to 124K. Currently
`guix pull` downloads a 10.2 MiB tarball. Just food for thought ;)

> +    (license license:gpl2+)))

The first file I checked in the Git repo has a different license:
https://github.com/vegandevs/vegan/blob/master/src/pnpoly.c

Can you check if there are any other files with different licenses?
Leo Famulari June 18, 2016, 1 a.m. UTC | #2
On Fri, Jun 17, 2016 at 08:56:16PM -0400, Leo Famulari wrote:
> On Thu, Jun 16, 2016 at 10:47:53PM +1000, Ben Woodcroft wrote:
> > * gnu/packages/bioinformatics.scm (r-vegan): New variable.
> > * gnu/packages/patches/vegan-revert-test-deletion.patch: New file.
> 
> This patch is 460K uncompressed. gzip reduces it to 124K. Currently
> `guix pull` downloads a 10.2 MiB tarball. Just food for thought ;)

By the way, thanks for addressing the question of the tests with the
upstream maintainers!

> 
> > +    (license license:gpl2+)))
> 
> The first file I checked in the Git repo has a different license:
> https://github.com/vegandevs/vegan/blob/master/src/pnpoly.c
> 
> Can you check if there are any other files with different licenses?
Ludovic Courtès June 19, 2016, 1:48 p.m. UTC | #3
Leo Famulari <leo@famulari.name> skribis:

> On Thu, Jun 16, 2016 at 10:47:53PM +1000, Ben Woodcroft wrote:
>> * gnu/packages/bioinformatics.scm (r-vegan): New variable.
>> * gnu/packages/patches/vegan-revert-test-deletion.patch: New file.
>
> This patch is 460K uncompressed. gzip reduces it to 124K. Currently
> `guix pull` downloads a 10.2 MiB tarball. Just food for thought ;)

Heh.  AIUI, the patch simply removes files; it’s more space-efficient
and clearer to do it in a ‘snippet’.

Would it work for you, Ben?

Thanks,
Ludo’.
Ben Woodcroft June 21, 2016, 11:43 a.m. UTC | #4
On 19/06/16 23:48, Ludovic Courtès wrote:
> Leo Famulari <leo@famulari.name> skribis:
>
>> On Thu, Jun 16, 2016 at 10:47:53PM +1000, Ben Woodcroft wrote:
>>> * gnu/packages/bioinformatics.scm (r-vegan): New variable.
>>> * gnu/packages/patches/vegan-revert-test-deletion.patch: New file.
>> This patch is 460K uncompressed. gzip reduces it to 124K. Currently
>> `guix pull` downloads a 10.2 MiB tarball. Just food for thought ;)
> Heh.  AIUI, the patch simply removes files; it’s more space-efficient
> and clearer to do it in a ‘snippet’.

The idea is actually to revert the deletion (of the test files).

Instead of including the 'revert' patch taking up space, I sourced the 
patch from GitHub as a native-input and applied it in reverse, and 
pushed this series.

Thanks for picking this up.
ben
diff mbox

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index abd05ef..c6aa4fc 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -805,6 +805,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/util-linux-tests.patch			\
   %D%/packages/patches/upower-builddir.patch			\
   %D%/packages/patches/valgrind-enable-arm.patch		\
+  %D%/packages/patches/vegan-revert-test-deletion.patch         \
   %D%/packages/patches/vorbis-tools-CVE-2014-9638+CVE-2014-9639.patch		\
   %D%/packages/patches/vorbis-tools-CVE-2014-9640.patch		\
   %D%/packages/patches/vorbis-tools-CVE-2015-6749.patch		\
diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 04ed769..03a4a02 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -3815,6 +3815,36 @@  data in the form of VCF files.")
     ;; at https://vcftools.github.io/license.html
     (license license:lgpl3)))
 
+(define-public r-vegan
+  (package
+    (name "r-vegan")
+    (version "2.4-0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (cran-uri "vegan" version))
+       (sha256
+        (base32
+         "10cygzkyg2m0y054ygivqxrkvqz792qsg6bmbdfzaqq37qv4wc7z"))
+       (patches (search-patches "vegan-revert-test-deletion.patch"))))
+    (build-system r-build-system)
+    (native-inputs
+     `(("gfortran" ,gfortran)
+       ("r-knitr" ,r-knitr)))
+    (propagated-inputs
+     `(("r-cluster" ,r-cluster)
+       ("r-lattice" ,r-lattice)
+       ("r-mgcv" ,r-mgcv)
+       ("r-permute" ,r-permute)))
+    (home-page "https://cran.r-project.org/web/packages/vegan")
+    (synopsis "Functions for community ecology")
+    (description
+     "The vegan package provides tools for descriptive community ecology.  It
+has most basic functions of diversity analysis, community ordination and
+dissimilarity analysis.  Most of its multivariate tools can be used for other
+data types as well.")
+    (license license:gpl2+)))
+
 (define-public vsearch
   (package
     (name "vsearch")
diff --git a/gnu/packages/patches/vegan-revert-test-deletion.patch b/gnu/packages/patches/vegan-revert-test-deletion.patch
new file mode 100644
index 0000000..c93e390
--- /dev/null
+++ b/gnu/packages/patches/vegan-revert-test-deletion.patch
@@ -0,0 +1,12227 @@ 
+The distributed sources do not include tests with the CRAN package.  Here we
+revert the commit `591d0e8ba1deaaf82445474ec6619c0b43db4e63' which deletes
+these tests.  There are plans to not delete tests in future as documented at
+https://github.com/vegandevs/vegan/issues/181.
+
+diff --git a/tests/Examples/vegan-Ex.Rout.save b/tests/Examples/vegan-Ex.Rout.save
+new file mode 100644
+index 0000000..be41f6d
+--- /dev/null
++++ b/tests/Examples/vegan-Ex.Rout.save
+@@ -0,0 +1,8896 @@
++
++R version 3.3.0 Patched (2016-05-12 r70603) -- "Supposedly Educational"
++Copyright (C) 2016 The R Foundation for Statistical Computing
++Platform: x86_64-pc-linux-gnu (64-bit)
++
++R is free software and comes with ABSOLUTELY NO WARRANTY.
++You are welcome to redistribute it under certain conditions.
++Type 'license()' or 'licence()' for distribution details.
++
++  Natural language support but running in an English locale
++
++R is a collaborative project with many contributors.
++Type 'contributors()' for more information and
++'citation()' on how to cite R or R packages in publications.
++
++Type 'demo()' for some demos, 'help()' for on-line help, or
++'help.start()' for an HTML browser interface to help.
++Type 'q()' to quit R.
++
++> pkgname <- "vegan"
++> source(file.path(R.home("share"), "R", "examples-header.R"))
++> options(warn = 1)
++> library('vegan')
++Loading required package: permute
++Loading required package: lattice
++This is vegan 2.4-0
++> 
++> base::assign(".oldSearch", base::search(), pos = 'CheckExEnv')
++> cleanEx()
++> nameEx("BCI")
++> ### * BCI
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: BCI
++> ### Title: Barro Colorado Island Tree Counts
++> ### Aliases: BCI BCI.env
++> ### Keywords: datasets
++> 
++> ### ** Examples
++> 
++> data(BCI, BCI.env)
++> head(BCI.env)
++  UTM.EW  UTM.NS Precipitation Elevation Age.cat Geology  Habitat Stream EnvHet
++1 625754 1011569          2530       120      c3      Tb OldSlope    Yes 0.6272
++2 625754 1011669          2530       120      c3      Tb   OldLow    Yes 0.3936
++3 625754 1011769          2530       120      c3      Tb   OldLow     No 0.0000
++4 625754 1011869          2530       120      c3      Tb   OldLow     No 0.0000
++5 625754 1011969          2530       120      c3      Tb OldSlope     No 0.4608
++6 625854 1011569          2530       120      c3      Tb   OldLow     No 0.0768
++> ## see changed species names
++> oldnames <- attr(BCI, "original.names")
++> taxa <- cbind("Old Names" = oldnames, "Current Names" = names(BCI))
++> noquote(taxa[taxa[,1] != taxa[,2], ])
++      Old Names                     Current Names                 
++ [1,] Abarema.macradenium           Abarema.macradenia            
++ [2,] Acacia.melanoceras            Vachellia.melanoceras         
++ [3,] Apeiba.aspera                 Apeiba.glabra                 
++ [4,] Aspidosperma.cruenta          Aspidosperma.desmanthum       
++ [5,] Cassipourea.elliptica         Cassipourea.guianensis        
++ [6,] Cespedezia.macrophylla        Cespedesia.spathulata         
++ [7,] Chlorophora.tinctoria         Maclura.tinctoria             
++ [8,] Coccoloba.manzanillensis      Coccoloba.manzinellensis      
++ [9,] Coussarea.curvigemmia         Coussarea.curvigemma          
++[10,] Cupania.sylvatica             Cupania.seemannii             
++[11,] Dipteryx.panamensis           Dipteryx.oleifera             
++[12,] Eugenia.coloradensis          Eugenia.florida               
++[13,] Eugenia.oerstedeana           Eugenia.oerstediana           
++[14,] Guapira.standleyana           Guapira.myrtiflora            
++[15,] Hyeronima.alchorneoides       Hieronyma.alchorneoides       
++[16,] Inga.marginata                Inga.semialata                
++[17,] Lonchocarpus.latifolius       Lonchocarpus.heptaphyllus     
++[18,] Maquira.costaricana           Maquira.guianensis.costaricana
++[19,] Phoebe.cinnamomifolia         Cinnamomum.triplinerve        
++[20,] Swartzia.simplex.var.ochnacea Swartzia.simplex.continentalis
++[21,] Tabebuia.guayacan             Handroanthus.guayacan         
++> 
++> 
++> 
++> cleanEx()
++> nameEx("CCorA")
++> ### * CCorA
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: CCorA
++> ### Title: Canonical Correlation Analysis
++> ### Aliases: CCorA biplot.CCorA
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> # Example using two mite groups. The mite data are available in vegan
++> data(mite)
++> # Two mite species associations (Legendre 2005, Fig. 4)
++> group.1 <- c(1,2,4:8,10:15,17,19:22,24,26:30)
++> group.2 <- c(3,9,16,18,23,25,31:35)
++> # Separate Hellinger transformations of the two groups of species 
++> mite.hel.1 <- decostand(mite[,group.1], "hel")
++> mite.hel.2 <- decostand(mite[,group.2], "hel")
++> rownames(mite.hel.1) = paste("S",1:nrow(mite),sep="")
++> rownames(mite.hel.2) = paste("S",1:nrow(mite),sep="")
++> out <- CCorA(mite.hel.1, mite.hel.2)
++> out
++
++Canonical Correlation Analysis
++
++Call:
++CCorA(Y = mite.hel.1, X = mite.hel.2) 
++
++              Y  X
++Matrix Ranks 24 11
++
++Pillai's trace:  4.573009 
++
++Significance of Pillai's trace:
++from F-distribution:   0.0032737 
++                       CanAxis1 CanAxis2 CanAxis3 CanAxis4 CanAxis5 CanAxis6
++Canonical Correlations  0.92810  0.82431  0.81209  0.74981  0.70795  0.65950
++                       CanAxis7 CanAxis8 CanAxis9 CanAxis10 CanAxis11
++Canonical Correlations  0.50189  0.48179  0.41089   0.37823      0.28
++
++                     Y | X  X | Y
++RDA R squares      0.33224 0.5376
++adj. RDA R squares 0.20560 0.2910
++
++> biplot(out, "ob")                 # Two plots of objects
++> biplot(out, "v", cex=c(0.7,0.6))  # Two plots of variables
++> biplot(out, "ov", cex=c(0.7,0.6)) # Four plots (2 for objects, 2 for variables)
++> biplot(out, "b", cex=c(0.7,0.6))  # Two biplots
++> biplot(out, xlabs = NA, plot.axes = c(3,5))    # Plot axes 3, 5. No object names
++> biplot(out, plot.type="biplots", xlabs = NULL) # Replace object names by numbers
++> 
++> # Example using random numbers. No significant relationship is expected
++> mat1 <- matrix(rnorm(60),20,3)
++> mat2 <- matrix(rnorm(100),20,5)
++> out2 = CCorA(mat1, mat2, permutations=99)
++> out2
++
++Canonical Correlation Analysis
++
++Call:
++CCorA(Y = mat1, X = mat2, permutations = 99) 
++
++             Y X
++Matrix Ranks 3 5
++
++Pillai's trace:  0.6455578 
++
++Significance of Pillai's trace:
++from F-distribution:   0.70352 
++based on permutations: 0.69 
++Permutation: free
++Number of permutations: 99
++ 
++                       CanAxis1 CanAxis2 CanAxis3
++Canonical Correlations  0.69691  0.38140     0.12
++
++                      Y | X   X | Y
++RDA R squares       0.17066  0.1368
++adj. RDA R squares -0.12553 -0.0250
++
++> biplot(out2, "b")
++> 
++> 
++> 
++> cleanEx()
++> nameEx("MDSrotate")
++> ### * MDSrotate
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: MDSrotate
++> ### Title: Rotate First MDS Dimension Parallel to an External Variable
++> ### Aliases: MDSrotate
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> data(varechem)
++> mod <- monoMDS(vegdist(varespec))
++> mod <- with(varechem, MDSrotate(mod, pH))
++> plot(mod)
++> ef <- envfit(mod ~ pH, varechem, permutations = 0)
++> plot(ef)
++> ordisurf(mod ~ pH, varechem, knots = 1, add = TRUE)
++
++Family: gaussian 
++Link function: identity 
++
++Formula:
++y ~ poly(x1, 1) + poly(x2, 1)
++Total model degrees of freedom 3 
++
++REML score: -3.185099     
++> 
++> 
++> 
++> cleanEx()
++> nameEx("MOStest")
++> ### * MOStest
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: MOStest
++> ### Title: Mitchell-Olds & Shaw Test for the Location of Quadratic Extreme
++> ### Aliases: MOStest plot.MOStest fieller.MOStest profile.MOStest
++> ###   confint.MOStest
++> ### Keywords: models regression
++> 
++> ### ** Examples
++> 
++> ## The Al-Mufti data analysed in humpfit():
++> mass <- c(140,230,310,310,400,510,610,670,860,900,1050,1160,1900,2480)
++> spno <- c(1,  4,  3,  9, 18, 30, 20, 14,  3,  2,  3,  2,  5,  2)
++> mod <- MOStest(mass, spno)
++> ## Insignificant
++> mod
++
++Mitchell-Olds and Shaw test
++Null: hump of a quadratic linear predictor is at min or max
++
++Family: gaussian 
++Link function: identity 
++
++      hump        min        max 
++  46.89749  140.00000 2480.00000 
++***** Caution: hump/pit not bracketed by the data ******
++
++            min/max      F Pr(>F)
++hump at min     140 0.0006 0.9816
++hump at max    2480 0.3161 0.5852
++Combined                   0.9924
++> ## ... but inadequate shape of the curve
++> op <- par(mfrow=c(2,2), mar=c(4,4,1,1)+.1)
++> plot(mod)
++> ## Looks rather like log-link with Poisson error and logarithmic biomass
++> mod <- MOStest(log(mass), spno, family=quasipoisson)
++> mod
++
++Mitchell-Olds and Shaw test
++Null: hump of a quadratic linear predictor is at min or max
++
++Family: quasipoisson 
++Link function: log 
++
++     min     hump      max 
++4.941642 6.243371 7.816014 
++
++            min/max      F  Pr(>F)  
++hump at min  4.9416 7.1367 0.02174 *
++hump at max  7.8160 9.0487 0.01191 *
++Combined                   0.03338 *
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> plot(mod)
++> par(op)
++> ## Confidence Limits
++> fieller.MOStest(mod)
++   2.5 %   97.5 % 
++5.255827 6.782979 
++> confint(mod)
++   2.5 %   97.5 % 
++5.816021 6.574378 
++> plot(profile(mod))
++> 
++> 
++> 
++> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
++> cleanEx()
++> nameEx("RsquareAdj")
++> ### * RsquareAdj
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: RsquareAdj
++> ### Title: Adjusted R-square
++> ### Aliases: RsquareAdj RsquareAdj.default RsquareAdj.rda RsquareAdj.cca
++> ###   RsquareAdj.lm RsquareAdj.glm
++> ### Keywords: univar multivariate
++> 
++> ### ** Examples
++> 
++> data(mite)
++> data(mite.env)
++> ## rda
++> m <- rda(decostand(mite, "hell") ~  ., mite.env)
++> RsquareAdj(m)
++$r.squared
++[1] 0.5265047
++
++$adj.r.squared
++[1] 0.4367038
++
++> ## cca
++> m <- cca(decostand(mite, "hell") ~  ., mite.env)
++> RsquareAdj(m)
++$r.squared
++[1] 0.4471676
++
++$adj.r.squared
++[1] 0.34442
++
++> ## default method
++> RsquareAdj(0.8, 20, 5)
++[1] 0.7285714
++> 
++> 
++> 
++> cleanEx()
++> nameEx("SSarrhenius")
++> ### * SSarrhenius
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: SSarrhenius
++> ### Title: Self-Starting nls Species-Area Models
++> ### Aliases: SSarrhenius SSlomolino SSgitay SSgleason
++> ### Keywords: models
++> 
++> ### ** Examples
++> 
++> ## Get species area data: sipoo.area gives the areas of islands
++> example(sipoo)
++
++sipoo> data(sipoo)
++
++sipoo> ## Areas of the islands in hectares
++sipoo> sipoo.area <-  c(1.1, 2.1, 2.2, 3.1, 3.5, 5.8, 6, 6.1, 6.5, 11.4, 13,
++sipoo+ 14.5, 16.1 ,17.5, 28.7, 40.5, 104.5, 233) 
++> S <- specnumber(sipoo)
++> plot(S ~ sipoo.area, xlab = "Island Area (ha)", ylab = "Number of Species",
+++     ylim = c(1, max(S)))
++> ## The Arrhenius model
++> marr <- nls(S ~ SSarrhenius(sipoo.area, k, z))
++> marr
++Nonlinear regression model
++  model: S ~ SSarrhenius(sipoo.area, k, z)
++   data: parent.frame()
++     k      z 
++3.4062 0.4364 
++ residual sum-of-squares: 78.1
++
++Number of iterations to convergence: 5 
++Achieved convergence tolerance: 1.056e-06
++> ## confidence limits from profile likelihood
++> confint(marr)
++Waiting for profiling to be done...
++       2.5%     97.5%
++k 2.6220312 4.3033906
++z 0.3813576 0.4944693
++> ## draw a line
++> xtmp <- seq(min(sipoo.area), max(sipoo.area), len=51)
++> lines(xtmp, predict(marr, newdata=data.frame(sipoo.area = xtmp)), lwd=2)
++> ## The normal way is to use linear regression on log-log data,
++> ## but this will be different from the previous:
++> mloglog <- lm(log(S) ~ log(sipoo.area))
++> mloglog
++
++Call:
++lm(formula = log(S) ~ log(sipoo.area))
++
++Coefficients:
++    (Intercept)  log(sipoo.area)  
++         1.0111           0.4925  
++
++> lines(xtmp, exp(predict(mloglog, newdata=data.frame(sipoo.area=xtmp))),
+++    lty=2)
++> ## Gleason: log-linear
++> mgle <- nls(S ~ SSgleason(sipoo.area, k, slope))
++> lines(xtmp, predict(mgle, newdata=data.frame(sipoo.area=xtmp)),
+++   lwd=2, col=2)
++> ## Gitay: quadratic of log-linear
++> mgit <- nls(S ~ SSgitay(sipoo.area, k, slope))
++> lines(xtmp, predict(mgit, newdata=data.frame(sipoo.area=xtmp)), 
+++   lwd=2, col = 3)
++> ## Lomolino: using original names of the parameters (Lomolino 2000):
++> mlom <- nls(S ~ SSlomolino(sipoo.area, Smax, A50, Hill))
++> mlom
++Nonlinear regression model
++  model: S ~ SSlomolino(sipoo.area, Smax, A50, Hill)
++   data: parent.frame()
++  Smax    A50   Hill 
++53.493 94.697  2.018 
++ residual sum-of-squares: 55.37
++
++Number of iterations to convergence: 6 
++Achieved convergence tolerance: 9.715e-07
++> lines(xtmp, predict(mlom, newdata=data.frame(sipoo.area=xtmp)), 
+++   lwd=2, col = 4)
++> ## One canned model of standard R:
++> mmic <- nls(S ~ SSmicmen(sipoo.area, slope, Asym))
++> lines(xtmp, predict(mmic, newdata = data.frame(sipoo.area=xtmp)),
+++   lwd =2, col = 5)
++> legend("bottomright", c("Arrhenius", "log-log linear", "Gleason", "Gitay", 
+++   "Lomolino", "Michaelis-Menten"), col=c(1,1,2,3,4,5), lwd=c(2,1,2,2,2,2), 
+++    lty=c(1,2,1,1,1,1))
++> ## compare models (AIC)
++> allmods <- list(Arrhenius = marr, Gleason = mgle, Gitay = mgit, 
+++    Lomolino = mlom, MicMen= mmic)
++> sapply(allmods, AIC)
++Arrhenius   Gleason     Gitay  Lomolino    MicMen 
++ 83.49847  96.94018  80.54984  79.30718  83.02003 
++> 
++> 
++> 
++> cleanEx()
++> nameEx("add1.cca")
++> ### * add1.cca
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: add1.cca
++> ### Title: Add or Drop Single Terms to a Constrained Ordination Model
++> ### Aliases: add1.cca drop1.cca
++> ### Keywords: multivariate models
++> 
++> ### ** Examples
++> 
++> data(dune)
++> data(dune.env)
++> ## Automatic model building based on AIC but with permutation tests
++> step(cca(dune ~  1, dune.env), reformulate(names(dune.env)), test="perm")
++Start:  AIC=87.66
++dune ~ 1
++
++             Df    AIC      F Pr(>F)   
+++ Moisture    3 86.608 2.2536  0.005 **
+++ Management  3 86.935 2.1307  0.005 **
+++ A1          1 87.411 2.1400  0.025 * 
++<none>          87.657                 
+++ Manure      4 88.832 1.5251  0.045 * 
+++ Use         2 89.134 1.1431  0.295   
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++
++Step:  AIC=86.61
++dune ~ Moisture
++
++             Df    AIC      F Pr(>F)   
++<none>          86.608                 
+++ Management  3 86.813 1.4565  0.045 * 
+++ A1          1 86.992 1.2624  0.150   
+++ Use         2 87.259 1.2760  0.120   
+++ Manure      4 87.342 1.3143  0.040 * 
++- Moisture    3 87.657 2.2536  0.010 **
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++Call: cca(formula = dune ~ Moisture, data = dune.env)
++
++              Inertia Proportion Rank
++Total          2.1153     1.0000     
++Constrained    0.6283     0.2970    3
++Unconstrained  1.4870     0.7030   16
++Inertia is mean squared contingency coefficient 
++
++Eigenvalues for constrained axes:
++  CCA1   CCA2   CCA3 
++0.4187 0.1330 0.0766 
++
++Eigenvalues for unconstrained axes:
++   CA1    CA2    CA3    CA4    CA5    CA6    CA7    CA8    CA9   CA10   CA11 
++0.4098 0.2259 0.1761 0.1234 0.1082 0.0908 0.0859 0.0609 0.0566 0.0467 0.0419 
++  CA12   CA13   CA14   CA15   CA16 
++0.0201 0.0143 0.0099 0.0085 0.0080 
++
++> ## see ?ordistep to do the same, but based on permutation P-values
++> ## Not run: 
++> ##D ordistep(cca(dune ~  1, dune.env), reformulate(names(dune.env)), perm.max=200)
++> ## End(Not run)
++> ## Manual model building
++> ## -- define the maximal model for scope
++> mbig <- rda(dune ~  ., dune.env)
++> ## -- define an empty model to start with
++> m0 <- rda(dune ~ 1, dune.env)
++> ## -- manual selection and updating
++> add1(m0, scope=formula(mbig), test="perm")
++           Df    AIC      F Pr(>F)   
++<none>        89.620                 
++A1          1 89.591 1.9217  0.060 . 
++Moisture    3 87.707 2.5883  0.005 **
++Management  3 87.082 2.8400  0.005 **
++Use         2 91.032 1.1741  0.280   
++Manure      4 89.232 1.9539  0.015 * 
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> m0 <- update(m0, . ~ . + Management)
++> add1(m0, scope=formula(mbig), test="perm")
++         Df    AIC      F Pr(>F)   
++<none>      87.082                 
++A1        1 87.424 1.2965  0.175   
++Moisture  3 85.567 1.9764  0.005 **
++Use       2 88.284 1.0510  0.440   
++Manure    3 87.517 1.3902  0.095 . 
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> m0 <- update(m0, . ~ . + Moisture)
++> ## -- included variables still significant?
++> drop1(m0, test="perm")
++           Df    AIC      F Pr(>F)   
++<none>        85.567                 
++Management  3 87.707 2.1769  0.010 **
++Moisture    3 87.082 1.9764  0.005 **
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> add1(m0, scope=formula(mbig), test="perm")
++       Df    AIC      F Pr(>F)
++<none>    85.567              
++A1      1 86.220 0.8359  0.645
++Use     2 86.842 0.8027  0.700
++Manure  3 85.762 1.1225  0.320
++> 
++> 
++> 
++> cleanEx()
++> nameEx("adipart")
++> ### * adipart
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: adipart
++> ### Title: Additive Diversity Partitioning and Hierarchical Null Model
++> ###   Testing
++> ### Aliases: adipart adipart.default adipart.formula hiersimu
++> ###   hiersimu.default hiersimu.formula
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> ## NOTE: 'nsimul' argument usually needs to be >= 99
++> ## here much lower value is used for demonstration
++> 
++> data(mite)
++> data(mite.xy)
++> data(mite.env)
++> ## Function to get equal area partitions of the mite data
++> cutter <- function (x, cut = seq(0, 10, by = 2.5)) {
+++     out <- rep(1, length(x))
+++     for (i in 2:(length(cut) - 1))
+++         out[which(x > cut[i] & x <= cut[(i + 1)])] <- i
+++     return(out)}
++> ## The hierarchy of sample aggregation
++> levsm <- with(mite.xy, data.frame(
+++     l1=1:nrow(mite),
+++     l2=cutter(y, cut = seq(0, 10, by = 2.5)),
+++     l3=cutter(y, cut = seq(0, 10, by = 5)),
+++     l4=cutter(y, cut = seq(0, 10, by = 10))))
++> ## Let's see in a map
++> par(mfrow=c(1,3))
++> plot(mite.xy, main="l1", col=as.numeric(levsm$l1)+1, asp = 1)
++> plot(mite.xy, main="l2", col=as.numeric(levsm$l2)+1, asp = 1)
++> plot(mite.xy, main="l3", col=as.numeric(levsm$l3)+1, asp = 1)
++> par(mfrow=c(1,1))
++> ## Additive diversity partitioning
++> adipart(mite, index="richness", nsimul=19)
++adipart object
++
++Call: adipart(y = mite, index = "richness", nsimul = 19)
++
++nullmodel method ‘r2dtable’ with 19 simulations
++options:  index richness, weights unif
++alternative hypothesis: statistic is less or greater than simulated values
++
++        statistic    SES   mean   2.5%    50%  97.5% Pr(sim.)  
++alpha.1    15.114 -38.43 22.344 22.032 22.300 22.608     0.05 *
++gamma      35.000   0.00 35.000 35.000 35.000 35.000     1.00  
++beta.1     19.886  38.43 12.656 12.392 12.700 12.968     0.05 *
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> adipart(mite ~ ., levsm, index="richness", nsimul=19)
++adipart object
++
++Call: adipart(formula = mite ~ ., data = levsm, index = "richness",
++nsimul = 19)
++
++nullmodel method ‘r2dtable’ with 19 simulations
++options:  index richness, weights unif
++alternative hypothesis: statistic is less or greater than simulated values
++
++        statistic      SES     mean     2.5%      50%   97.5% Pr(sim.)  
++alpha.1    15.114 -46.2370 22.39624 22.12571 22.44286 22.6236     0.05 *
++alpha.2    29.750 -21.7076 34.81579 34.36250 35.00000 35.0000     0.05 *
++alpha.3    33.000   0.0000 35.00000 35.00000 35.00000 35.0000     0.05 *
++gamma      35.000   0.0000 35.00000 35.00000 35.00000 35.0000     1.00  
++beta.1     14.636   9.0407 12.41955 12.00750 12.42857 12.8743     0.05 *
++beta.2      3.250  13.1373  0.18421  0.00000  0.00000  0.6375     0.05 *
++beta.3      2.000   0.0000  0.00000  0.00000  0.00000  0.0000     0.05 *
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> ## Hierarchical null model testing
++> ## diversity analysis (similar to adipart)
++> hiersimu(mite, FUN=diversity, relative=TRUE, nsimul=19)
++hiersimu object
++
++Call: hiersimu(y = mite, FUN = diversity, relative = TRUE, nsimul = 19)
++
++nullmodel method ‘r2dtable’ with 19 simulations
++
++alternative hypothesis: statistic is less or greater than simulated values
++
++        statistic     SES    mean    2.5%     50%  97.5% Pr(sim.)  
++level_1   0.76064 -71.195 0.93904 0.93487 0.93856 0.9444     0.05 *
++leve_2    1.00000   0.000 1.00000 1.00000 1.00000 1.0000     1.00  
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> hiersimu(mite ~., levsm, FUN=diversity, relative=TRUE, nsimul=19)
++hiersimu object
++
++Call: hiersimu(formula = mite ~ ., data = levsm, FUN = diversity,
++relative = TRUE, nsimul = 19)
++
++nullmodel method ‘r2dtable’ with 19 simulations
++
++alternative hypothesis: statistic is less or greater than simulated values
++
++   statistic      SES    mean    2.5%     50%  97.5% Pr(sim.)  
++l1   0.76064  -75.139 0.93833 0.93389 0.93819 0.9427     0.05 *
++l2   0.89736 -110.968 0.99811 0.99699 0.99814 0.9999     0.05 *
++l3   0.92791 -417.338 0.99940 0.99904 0.99943 0.9996     0.05 *
++l4   1.00000    0.000 1.00000 1.00000 1.00000 1.0000     1.00  
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> ## Hierarchical testing with the Morisita index
++> morfun <- function(x) dispindmorisita(x)$imst
++> hiersimu(mite ~., levsm, morfun, drop.highest=TRUE, nsimul=19)
++hiersimu object
++
++Call: hiersimu(formula = mite ~ ., data = levsm, FUN = morfun,
++drop.highest = TRUE, nsimul = 19)
++
++nullmodel method ‘r2dtable’ with 19 simulations
++
++alternative hypothesis: statistic is less or greater than simulated values
++
++   statistic     SES      mean      2.5%       50%   97.5% Pr(sim.)  
++l1   0.52070  8.5216  0.353253  0.322624  0.351073  0.3848     0.05 *
++l2   0.60234 14.3854  0.153047  0.096700  0.150434  0.1969     0.05 *
++l3   0.67509 20.3162 -0.182473 -0.234793 -0.195937 -0.0988     0.05 *
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> 
++> 
++> 
++> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
++> cleanEx()
++> nameEx("adonis")
++> ### * adonis
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: adonis
++> ### Title: Permutational Multivariate Analysis of Variance Using Distance
++> ###   Matrices
++> ### Aliases: adonis adonis2
++> ### Keywords: multivariate nonparametric
++> 
++> ### ** Examples
++> 
++> data(dune)
++> data(dune.env)
++> ## default test by terms
++> adonis2(dune ~ Management*A1, data = dune.env)
++Permutation test for adonis under reduced model
++Terms added sequentially (first to last)
++Permutation: free
++Number of permutations: 999
++
++adonis2(formula = dune ~ Management * A1, data = dune.env)
++              Df SumOfSqs      F Pr(>F)   
++Management     3  1.46859 3.2629  0.002 **
++A1             1  0.44089 2.9387  0.022 * 
++Management:A1  3  0.58918 1.3090  0.191   
++Residual      12  1.80036                 
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> ## overall tests
++> adonis2(dune ~ Management*A1, data = dune.env, by = NULL)
++Permutation test for adonis under reduced model
++Permutation: free
++Number of permutations: 999
++
++adonis2(formula = dune ~ Management * A1, data = dune.env, by = NULL)
++         Df SumOfSqs      F Pr(>F)   
++Model     7   2.4987 2.3792  0.003 **
++Residual 12   1.8004                 
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> 
++> ### Example of use with strata, for nested (e.g., block) designs.
++> dat <- expand.grid(rep=gl(2,1), NO3=factor(c(0,10)),field=gl(3,1) )
++> dat
++   rep NO3 field
++1    1   0     1
++2    2   0     1
++3    1  10     1
++4    2  10     1
++5    1   0     2
++6    2   0     2
++7    1  10     2
++8    2  10     2
++9    1   0     3
++10   2   0     3
++11   1  10     3
++12   2  10     3
++> Agropyron <- with(dat, as.numeric(field) + as.numeric(NO3)+2) +rnorm(12)/2
++> Schizachyrium <- with(dat, as.numeric(field) - as.numeric(NO3)+2) +rnorm(12)/2
++> total <- Agropyron + Schizachyrium
++> dotplot(total ~ NO3, dat, jitter.x=TRUE, groups=field,
+++         type=c('p','a'), xlab="NO3", auto.key=list(columns=3, lines=TRUE) )
++> 
++> Y <- data.frame(Agropyron, Schizachyrium)
++> mod <- metaMDS(Y)
++Run 0 stress 0.06065252 
++Run 1 stress 0.06065252 
++... New best solution
++... Procrustes: rmse 3.164024e-06  max resid 6.043669e-06 
++... Similar to previous best
++Run 2 stress 0.06065252 
++... Procrustes: rmse 1.938469e-06  max resid 3.61423e-06 
++... Similar to previous best
++Run 3 stress 0.142919 
++Run 4 stress 0.1670077 
++Run 5 stress 0.175151 
++Run 6 stress 0.1751507 
++Run 7 stress 0.06065252 
++... Procrustes: rmse 3.943561e-06  max resid 7.519499e-06 
++... Similar to previous best
++Run 8 stress 0.06065252 
++... New best solution
++... Procrustes: rmse 2.172863e-06  max resid 4.032152e-06 
++... Similar to previous best
++Run 9 stress 0.1820814 
++Run 10 stress 0.06065252 
++... New best solution
++... Procrustes: rmse 1.026253e-06  max resid 1.4719e-06 
++... Similar to previous best
++Run 11 stress 0.06065252 
++... New best solution
++... Procrustes: rmse 1.828471e-06  max resid 3.763468e-06 
++... Similar to previous best
++Run 12 stress 0.06065252 
++... Procrustes: rmse 3.138136e-06  max resid 6.223657e-06 
++... Similar to previous best
++Run 13 stress 0.06065252 
++... Procrustes: rmse 3.415889e-06  max resid 6.880638e-06 
++... Similar to previous best
++Run 14 stress 0.06065252 
++... Procrustes: rmse 3.066271e-06  max resid 5.908388e-06 
++... Similar to previous best
++Run 15 stress 0.06065252 
++... Procrustes: rmse 1.945053e-06  max resid 3.557283e-06 
++... Similar to previous best
++Run 16 stress 0.06065252 
++... Procrustes: rmse 5.441366e-06  max resid 9.82099e-06 
++... Similar to previous best
++Run 17 stress 0.1820814 
++Run 18 stress 0.1659224 
++Run 19 stress 0.1820814 
++Run 20 stress 0.2291418 
++*** Solution reached
++> plot(mod)
++> ### Ellipsoid hulls show treatment
++> with(dat, ordiellipse(mod, field, kind = "ehull", label = TRUE))
++> ### Spider shows fields
++> with(dat, ordispider(mod, field, lty=3, col="red"))
++> 
++> ### Incorrect (no strata)
++> perm <- how(nperm = 199)
++> adonis2 (Y ~ NO3, data = dat, permutations = perm)
++Permutation test for adonis under reduced model
++Terms added sequentially (first to last)
++Permutation: free
++Number of permutations: 199
++
++adonis2(formula = Y ~ NO3, data = dat, permutations = perm)
++         Df SumOfSqs      F Pr(>F)  
++NO3       1 0.036334 3.5509   0.04 *
++Residual 10 0.102324                
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> 
++> ## Correct with strata
++> setBlocks(perm) <- with(dat, field)
++> adonis2(Y ~ NO3, data = dat, permutations = perm)
++Permutation test for adonis under reduced model
++Terms added sequentially (first to last)
++Blocks:  with(dat, field) 
++Permutation: free
++Number of permutations: 199
++
++adonis2(formula = Y ~ NO3, data = dat, permutations = perm)
++         Df SumOfSqs      F Pr(>F)  
++NO3       1 0.036334 3.5509   0.02 *
++Residual 10 0.102324                
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> 
++> 
++> 
++> cleanEx()
++> nameEx("anosim")
++> ### * anosim
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: anosim
++> ### Title: Analysis of Similarities
++> ### Aliases: anosim summary.anosim plot.anosim
++> ### Keywords: multivariate nonparametric htest
++> 
++> ### ** Examples
++> 
++> data(dune)
++> data(dune.env)
++> dune.dist <- vegdist(dune)
++> attach(dune.env)
++> dune.ano <- anosim(dune.dist, Management)
++> summary(dune.ano)
++
++Call:
++anosim(dat = dune.dist, grouping = Management) 
++Dissimilarity: bray 
++
++ANOSIM statistic R: 0.2579 
++      Significance: 0.017 
++
++Permutation: free
++Number of permutations: 999
++
++Upper quantiles of permutations (null model):
++  90%   95% 97.5%   99% 
++0.121 0.174 0.222 0.276 
++
++Dissimilarity ranks between and within classes:
++        0%   25%    50%     75%  100%   N
++Between  4 58.50 104.00 145.500 188.0 147
++BF       5 15.25  25.50  41.250  57.0   3
++HF       1  7.25  46.25  68.125  89.5  10
++NM       6 64.75 124.50 156.250 181.0  15
++SF       3 32.75  53.50  99.250 184.0  15
++
++> plot(dune.ano)
++Warning in bxp(list(stats = c(4, 58.5, 104, 145.5, 188, 5, 15.25, 25.5,  :
++  some notches went outside hinges ('box'): maybe set notch=FALSE
++> 
++> 
++> 
++> cleanEx()
++
++detaching ‘dune.env’
++
++> nameEx("anova.cca")
++> ### * anova.cca
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: anova.cca
++> ### Title: Permutation Test for Constrained Correspondence Analysis,
++> ###   Redundancy Analysis and Constrained Analysis of Principal Coordinates
++> ### Aliases: anova.cca permutest permutest.cca
++> ### Keywords: multivariate htest
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> data(varechem)
++> vare.cca <- cca(varespec ~ Al + P + K, varechem)
++> ## overall test
++> anova(vare.cca)
++Permutation test for cca under reduced model
++Permutation: free
++Number of permutations: 999
++
++Model: cca(formula = varespec ~ Al + P + K, data = varechem)
++         Df ChiSquare     F Pr(>F)    
++Model     3   0.64413 2.984  0.001 ***
++Residual 20   1.43906                 
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> 
++> 
++> 
++> cleanEx()
++> nameEx("as.mlm")
++> ### * as.mlm
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: as.mlm.cca
++> ### Title: Refit Constrained Ordination as a Multiple Response Linear Model
++> ### Aliases: as.mlm as.mlm.cca as.mlm.rda
++> ### Keywords: models multivariate
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> data(varechem)
++> mod <- cca(varespec ~ Al + P + K, data=varechem)
++> lmod <- as.mlm(mod)
++> ## Coefficients
++> lmod
++
++Call:
++lm(formula = wa ~ . - 1, data = as.data.frame(X))
++
++Coefficients:
++    CCA1       CCA2       CCA3     
++Al   0.007479  -0.001884   0.003381
++P   -0.006491  -0.102190  -0.022307
++K   -0.006756   0.015344   0.017067
++
++> coef(mod)
++           CCA1         CCA2         CCA3
++Al  0.007478556 -0.001883637  0.003380774
++P  -0.006491081 -0.102189737 -0.022306682
++K  -0.006755568  0.015343662  0.017067351
++> ## Influential observations
++> influence.measures(lmod)
++Influence measures of
++	 lm(formula = wa ~ . - 1, data = as.data.frame(X)) :
++
++      dfb.Al    dfb.P    dfb.K     CCA1    CCA2      CCA3  cov.r   CCA1.1
++18 -0.251387  0.00976 -0.06310  0.27401  0.1806 -0.118754 0.0265 7.38e-03
++15  0.099858  0.13864 -0.11781 -0.16542 -0.0935  0.006898 0.0319 2.86e-03
++24 -0.003448 -0.44078  0.20788 -0.48239 -0.1750 -0.260788 0.0307 2.33e-02
++27  0.071682 -0.01707 -0.03516 -0.10185 -0.1676  0.022271 0.0406 1.13e-03
++23 -0.116533  0.06900 -0.02545  0.14407  0.2918 -0.220457 0.0355 2.23e-03
++19 -0.007394 -0.01169  0.01080  0.01360 -0.2318 -0.000417 0.0359 2.02e-05
++22  0.150916  0.14845 -0.13091 -0.20466  0.3815  0.168914 0.0376 4.50e-03
++16  0.107456  0.17900 -0.09917 -0.21196  0.2250  0.194432 0.0338 4.75e-03
++28  0.332161 -0.34398 -0.05414 -0.67745  0.0742  0.620990 0.0364 4.65e-02
++13  0.366880 -1.00834  1.23685  1.33919  0.4102  0.277067 0.1124 1.89e-01
++14  0.024147  0.02512 -0.01161 -0.03608  0.1491  0.053638 0.0355 1.42e-04
++20  0.000747 -0.00560  0.00205 -0.00661  0.2935 -0.190351 0.0368 4.77e-06
++25  0.166736 -0.11049  0.09341 -0.20954 -0.1627 -0.070753 0.0346 4.66e-03
++7  -0.397145  0.15747  0.15662 -0.59116  0.5842 -0.838287 0.0327 3.51e-02
++5  -0.279996 -0.09119 -0.35616  0.73579  0.3694 -0.326563 0.0281 5.18e-02
++6   0.003191 -0.00168 -0.01550  0.02590  0.3447  0.201072 0.0400 7.34e-05
++3  -0.302851 -0.07889  0.25932 -0.41958 -0.2766  0.536017 0.0386 1.85e-02
++4  -0.058151 -0.02719  0.00870 -0.06644  0.8199  0.131003 0.0486 4.83e-04
++2   0.020380  0.00416 -0.00373  0.02055 -0.4158 -0.160401 0.0395 4.62e-05
++9   0.074217  0.09551 -0.10857  0.12712 -0.3481  0.644579 0.0383 1.75e-03
++12 -0.097825 -0.20830  0.04637  0.28644 -0.6601  0.270324 0.0280 8.19e-03
++10  0.149178  0.66594 -0.12975  0.89348 -0.2510  0.000571 0.0118 5.90e-02
++11  0.014687  0.00691  0.00105  0.01913  0.1838 -0.301086 0.0377 4.00e-05
++21  0.148213  0.15461 -0.02915 -0.25306 -0.1892 -0.318491 0.0361 6.81e-03
++     CCA2.1   CCA3.1    hat inf
++18 0.003207 1.39e-03 0.0321    
++15 0.000915 4.98e-06 0.0295    
++24 0.003071 6.82e-03 0.1135    
++27 0.003062 5.41e-05 0.1375    
++23 0.009151 5.22e-03 0.0555    
++19 0.005873 1.90e-08 0.0176    
++22 0.015648 3.07e-03 0.1077    
++16 0.005348 3.99e-03 0.0594    
++28 0.000559 3.91e-02 0.2256    
++13 0.017773 8.11e-03 0.7168   *
++14 0.002424 3.13e-04 0.0158    
++20 0.009421 3.96e-03 0.0393    
++25 0.002810 5.31e-04 0.0670    
++7  0.034274 7.06e-02 0.1635    
++5  0.013057 1.02e-02 0.1588    
++6  0.012996 4.42e-03 0.1169    
++3  0.008056 3.02e-02 0.1833    
++4  0.073491 1.88e-03 0.2741    
++2  0.018909 2.81e-03 0.1063    
++9  0.013158 4.51e-02 0.0978    
++12 0.043487 7.29e-03 0.0409    
++10 0.004658 2.41e-08 0.0768    
++11 0.003694 9.91e-03 0.0632    
++21 0.003807 1.08e-02 0.1009    
++> plot(mod, type = "n")
++> points(mod, cex = 10*hatvalues(lmod), pch=16, xpd = TRUE)
++> text(mod, display = "bp", col = "blue") 
++> 
++> 
++> 
++> cleanEx()
++> nameEx("beals")
++> ### * beals
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: beals
++> ### Title: Beals Smoothing and Degree of Absence
++> ### Aliases: beals swan
++> ### Keywords: manip smooth
++> 
++> ### ** Examples
++> 
++> data(dune)
++> ## Default
++> x <- beals(dune)
++> ## Remove target species
++> x <- beals(dune, include = FALSE)
++> ## Smoothed values against presence or absence of species
++> pa <- decostand(dune, "pa")
++> boxplot(as.vector(x) ~ unlist(pa), xlab="Presence", ylab="Beals")
++> ## Remove the bias of tarbet species: Yields lower values.
++> beals(dune, type =3, include = FALSE)
++     Achimill   Agrostol   Airaprae  Alopgeni   Anthodor  Bellpere   Bromhord
++1  0.49590853 0.38333415 0.01157407 0.4923280 0.30827883 0.4935662 0.43263047
++2  0.47083676 0.39501120 0.03361524 0.4718807 0.34723984 0.4917791 0.42000984
++3  0.34063019 0.52738394 0.01520046 0.5309152 0.21609954 0.4033301 0.33010938
++4  0.30816435 0.51198853 0.02876960 0.5971801 0.21542662 0.4398775 0.35732610
++5  0.59949785 0.27622698 0.06632771 0.3349203 0.48876285 0.4322142 0.44309579
++6  0.58819821 0.26299306 0.05967771 0.2700508 0.53154426 0.3696613 0.39760652
++7  0.56496165 0.29412293 0.05329633 0.3403047 0.48010987 0.4051777 0.40471531
++8  0.21230502 0.66906674 0.02588333 0.5187956 0.16247716 0.2720122 0.21219877
++9  0.30323659 0.59744543 0.02213662 0.5792855 0.21896113 0.3292320 0.28613526
++10 0.54083871 0.26902092 0.07349127 0.3372958 0.42671693 0.4705094 0.42934344
++11 0.40509331 0.31656550 0.10259239 0.3185489 0.38766111 0.3713794 0.31413659
++12 0.21008725 0.66278454 0.03625297 0.5753377 0.20078932 0.2802946 0.22974415
++13 0.21850759 0.68239707 0.02191119 0.6404427 0.16737280 0.2939740 0.24942466
++14 0.13570397 0.76284476 0.02298398 0.4107645 0.12128973 0.1682755 0.13757552
++15 0.09168815 0.79412733 0.02538032 0.4505613 0.10117099 0.1420251 0.09794548
++16 0.06335463 0.87877202 0.00742115 0.5232448 0.05538377 0.1516354 0.09458531
++17 0.55254140 0.07330247 0.29233391 0.1013889 0.69331132 0.3129358 0.34982363
++18 0.37751017 0.34451209 0.08535723 0.2838834 0.36918166 0.3676424 0.30478244
++19 0.29826049 0.25952255 0.35137675 0.1934048 0.51929869 0.2237843 0.18074796
++20 0.05429986 0.76675441 0.06144615 0.4063662 0.10738280 0.1450721 0.06706410
++      Chenalbu   Cirsarve    Comapalu   Eleopalu  Elymrepe   Empenigr
++1  0.025132275 0.09504980 0.000000000 0.05592045 0.4667439 0.00000000
++2  0.043866562 0.08570299 0.026548839 0.08656209 0.4407282 0.01829337
++3  0.065338638 0.08967477 0.031898812 0.16099072 0.4137888 0.01074444
++4  0.057970906 0.12920228 0.039859621 0.16112450 0.4399661 0.02527165
++5  0.026434737 0.05520104 0.015892090 0.05419613 0.3575948 0.03029752
++6  0.021256367 0.03223112 0.030347896 0.08784329 0.3138879 0.03093489
++7  0.038467708 0.04706743 0.017083997 0.06694311 0.3586644 0.02304603
++8  0.063278453 0.06688407 0.100703044 0.29777644 0.3046956 0.02102222
++9  0.069879277 0.07647268 0.045830682 0.19018562 0.3523460 0.01838883
++10 0.025686639 0.06037513 0.029746617 0.07787078 0.3736128 0.03425596
++11 0.021234732 0.05778318 0.035740922 0.11146095 0.2884798 0.07310076
++12 0.103543341 0.07799259 0.045375827 0.19518888 0.3354080 0.03413656
++13 0.122547745 0.07905124 0.056084315 0.22437598 0.3511708 0.01840390
++14 0.042990591 0.03618335 0.241811837 0.55982776 0.1428372 0.01989756
++15 0.035609053 0.04022968 0.198176675 0.53973883 0.1462975 0.02215971
++16 0.056246994 0.05184498 0.201352298 0.51523810 0.1832397 0.00742115
++17 0.007716049 0.01049383 0.009876543 0.02777778 0.1929470 0.21968254
++18 0.014640428 0.04454602 0.042890320 0.17341352 0.2651538 0.06763669
++19 0.019591245 0.03668466 0.031845637 0.12592768 0.1422725 0.26011417
++20 0.037623741 0.03453783 0.185726965 0.58476297 0.1168700 0.05905666
++     Hyporadi   Juncarti  Juncbufo  Lolipere   Planlanc   Poaprat   Poatriv
++1  0.07702746 0.14794933 0.1987270 0.9226190 0.40103107 0.9863946 0.8826329
++2  0.07454127 0.13017869 0.2070478 0.8272395 0.40700777 0.8972046 0.8288385
++3  0.05562332 0.22291082 0.2544828 0.7205525 0.27933493 0.8083020 0.8383185
++4  0.06985986 0.21320122 0.2318440 0.7197924 0.25797285 0.7940926 0.8197302
++5  0.10245961 0.10406655 0.2164230 0.8380779 0.52628928 0.9035899 0.8094632
++6  0.11463153 0.11631772 0.2166255 0.8000021 0.58765018 0.8666677 0.7782619
++7  0.10837376 0.11293676 0.2110045 0.8053380 0.51905808 0.8925059 0.8018775
++8  0.06550319 0.33219882 0.2323566 0.5403355 0.20596764 0.6160461 0.7101299
++9  0.05343787 0.23134366 0.2675624 0.6874068 0.25274756 0.7523318 0.8247374
++10 0.13692492 0.09080902 0.1678040 0.8102783 0.52588347 0.8915882 0.7543592
++11 0.18108995 0.13478872 0.1656396 0.7180948 0.47012501 0.8062720 0.6404351
++12 0.06777311 0.27306206 0.3231724 0.5875943 0.22110550 0.6932541 0.8199960
++13 0.04250245 0.28204736 0.3339728 0.5714581 0.18153869 0.7063028 0.7993754
++14 0.04665747 0.46685537 0.1206518 0.3356311 0.14342002 0.3817081 0.5090703
++15 0.05040404 0.51561767 0.1370235 0.3689922 0.13523214 0.4078219 0.5263520
++16 0.01731602 0.54304667 0.1776781 0.3561752 0.07269979 0.4124222 0.6071083
++17 0.36492870 0.03333333 0.1038156 0.5858415 0.59641331 0.7434618 0.5036834
++18 0.17491099 0.18956922 0.1376386 0.7124388 0.45087176 0.7368632 0.5859071
++19 0.39145281 0.13543701 0.1127832 0.4289185 0.40784415 0.5548077 0.3605827
++20 0.07795311 0.53056145 0.1192488 0.3262685 0.13059496 0.3662817 0.4523029
++     Ranuflam  Rumeacet  Sagiproc   Salirepe  Scorautu   Trifprat  Trifrepe
++1  0.08105273 0.3160963 0.3371121 0.02729885 0.8898317 0.21701279 0.8782576
++2  0.13042865 0.3031318 0.3302063 0.05983781 0.9349640 0.20673650 0.9125666
++3  0.22632936 0.2909068 0.4204104 0.06065155 0.9036443 0.14654749 0.8817430
++4  0.21909541 0.2610006 0.4191908 0.07579199 0.9204237 0.12896524 0.8943213
++5  0.08063087 0.3979230 0.2612828 0.07589611 0.9576838 0.34808957 0.9142360
++6  0.10909966 0.4330705 0.2539380 0.08921540 0.9590466 0.35423465 0.9110822
++7  0.10541081 0.4113622 0.2954682 0.07094548 0.9550487 0.32489503 0.9171688
++8  0.40134447 0.2331043 0.4009544 0.11569906 0.8755515 0.09897600 0.8002526
++9  0.26006489 0.3464870 0.4531178 0.07351827 0.9145996 0.16269563 0.8714833
++10 0.10355742 0.3226025 0.2732735 0.09037489 0.9568824 0.26807372 0.9003730
++11 0.13269569 0.2753878 0.3673397 0.16465286 0.9442707 0.19982976 0.8979262
++12 0.29873222 0.3507140 0.5122033 0.08041977 0.9377963 0.13849854 0.9079979
++13 0.33309468 0.3107471 0.5131337 0.06572594 0.9255312 0.11199114 0.8841739
++14 0.64674225 0.1241545 0.2528665 0.15917563 0.8477706 0.06176123 0.6485949
++15 0.64449081 0.1459458 0.3151199 0.17750323 0.8430677 0.05831084 0.7170446
++16 0.66893881 0.1508409 0.3480368 0.15783292 0.8131968 0.03916718 0.6776273
++17 0.03549383 0.2913631 0.3292030 0.25651777 0.9839744 0.27593101 0.8141660
++18 0.18805395 0.2668100 0.3154533 0.17191937 0.9554011 0.20461193 0.8600701
++19 0.14551892 0.1831168 0.4798245 0.36429493 0.9902041 0.11966159 0.8147968
++20 0.62796060 0.1098600 0.3105433 0.21674174 0.8457313 0.03708580 0.6350394
++     Vicilath  Bracruta    Callcusp
++1  0.17244420 0.7476589 0.003527337
++2  0.18494940 0.7415172 0.034597921
++3  0.12833142 0.7666969 0.075789630
++4  0.12550967 0.7919786 0.081110164
++5  0.16693075 0.8079786 0.023129027
++6  0.18035860 0.8387650 0.040981168
++7  0.19027523 0.8089116 0.024070054
++8  0.10213052 0.8109194 0.201958942
++9  0.08630413 0.7972178 0.092982775
++10 0.23383453 0.7660374 0.033527777
++11 0.24317802 0.8182692 0.043950322
++12 0.08049055 0.8061715 0.100954127
++13 0.06604026 0.7465509 0.122856392
++14 0.07857237 0.7238162 0.347514804
++15 0.07370069 0.7997141 0.381379395
++16 0.03353260 0.8029953 0.364128496
++17 0.20728700 0.7635487 0.009876543
++18 0.26222869 0.8397471 0.109959916
++19 0.18188455 0.8161275 0.082361157
++20 0.09111967 0.8397124 0.397924041
++> ## Uses abundance information.
++> ## Vector with beals smoothing values corresponding to the first species
++> ## in dune.
++> beals(dune, species=1, include=TRUE) 
++        1         2         3         4         5         6         7         8 
++0.5923077 0.5032372 0.3499038 0.3306953 0.5944041 0.5928780 0.5824352 0.2082532 
++        9        10        11        12        13        14        15        16 
++0.2960799 0.5462492 0.3659392 0.2610043 0.1982372 0.0922619 0.1140625 0.1066506 
++       17        18        19        20 
++0.6020408 0.3844577 0.2865741 0.0750000 
++> 
++> 
++> 
++> cleanEx()
++> nameEx("betadisper")
++> ### * betadisper
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: betadisper
++> ### Title: Multivariate homogeneity of groups dispersions (variances)
++> ### Aliases: betadisper scores.betadisper anova.betadisper plot.betadisper
++> ###   boxplot.betadisper TukeyHSD.betadisper eigenvals.betadisper
++> ###   ordimedian
++> ### Keywords: methods multivariate hplot
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> 
++> ## Bray-Curtis distances between samples
++> dis <- vegdist(varespec)
++> 
++> ## First 16 sites grazed, remaining 8 sites ungrazed
++> groups <- factor(c(rep(1,16), rep(2,8)), labels = c("grazed","ungrazed"))
++> 
++> ## Calculate multivariate dispersions
++> mod <- betadisper(dis, groups)
++> mod
++
++	Homogeneity of multivariate dispersions
++
++Call: betadisper(d = dis, group = groups)
++
++No. of Positive Eigenvalues: 15
++No. of Negative Eigenvalues: 8
++
++Average distance to median:
++  grazed ungrazed 
++  0.3926   0.2706 
++
++Eigenvalues for PCoA axes:
++ PCoA1  PCoA2  PCoA3  PCoA4  PCoA5  PCoA6  PCoA7  PCoA8 
++1.7552 1.1334 0.4429 0.3698 0.2454 0.1961 0.1751 0.1284 
++> 
++> ## Perform test
++> anova(mod)
++Analysis of Variance Table
++
++Response: Distances
++          Df  Sum Sq  Mean Sq F value  Pr(>F)  
++Groups     1 0.07931 0.079306  4.6156 0.04295 *
++Residuals 22 0.37801 0.017182                  
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> 
++> ## Permutation test for F
++> permutest(mod, pairwise = TRUE, permutations = 99)
++
++Permutation test for homogeneity of multivariate dispersions
++Permutation: free
++Number of permutations: 99
++
++Response: Distances
++          Df  Sum Sq  Mean Sq      F N.Perm Pr(>F)  
++Groups     1 0.07931 0.079306 4.6156     99   0.04 *
++Residuals 22 0.37801 0.017182                       
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++
++Pairwise comparisons:
++(Observed p-value below diagonal, permuted p-value above diagonal)
++          grazed ungrazed
++grazed               0.05
++ungrazed 0.04295         
++> 
++> ## Tukey's Honest Significant Differences
++> (mod.HSD <- TukeyHSD(mod))
++  Tukey multiple comparisons of means
++    95% family-wise confidence level
++
++Fit: aov(formula = distances ~ group, data = df)
++
++$group
++                      diff        lwr          upr     p adj
++ungrazed-grazed -0.1219422 -0.2396552 -0.004229243 0.0429502
++
++> plot(mod.HSD)
++> 
++> ## Plot the groups and distances to centroids on the
++> ## first two PCoA axes
++> plot(mod)
++> 
++> ## with data ellipses instead of hulls
++> plot(mod, ellipse = TRUE, hull = FALSE) # 1 sd data ellipse
++> plot(mod, ellipse = TRUE, hull = FALSE, conf = 0.90) # 90% data ellipse
++> 
++> ## can also specify which axes to plot, ordering respected
++> plot(mod, axes = c(3,1), seg.col = "forestgreen", seg.lty = "dashed")
++> 
++> ## Draw a boxplot of the distances to centroid for each group
++> boxplot(mod)
++> 
++> ## `scores` and `eigenvals` also work
++> scrs <- scores(mod)
++> str(scrs)
++List of 2
++ $ sites    : num [1:24, 1:2] 0.0946 -0.3125 -0.3511 -0.3291 -0.1926 ...
++  ..- attr(*, "dimnames")=List of 2
++  .. ..$ : chr [1:24] "18" "15" "24" "27" ...
++  .. ..$ : chr [1:2] "PCoA1" "PCoA2"
++ $ centroids: num [1:2, 1:2] -0.1455 0.2786 0.0758 -0.2111
++  ..- attr(*, "dimnames")=List of 2
++  .. ..$ : chr [1:2] "grazed" "ungrazed"
++  .. ..$ : chr [1:2] "PCoA1" "PCoA2"
++> head(scores(mod, 1:4, display = "sites"))
++         PCoA1       PCoA2        PCoA3        PCoA4
++18  0.09459373  0.15914576  0.074400844 -0.202466025
++15 -0.31248809  0.10032751 -0.062243360  0.110844864
++24 -0.35106507 -0.05954096 -0.038079447  0.095060928
++27 -0.32914546 -0.17019348  0.231623720  0.019110623
++23 -0.19259443 -0.01459250 -0.005679372 -0.209718312
++19 -0.06794575 -0.14501690 -0.085645653  0.002431355
++> # group centroids/medians 
++> scores(mod, 1:4, display = "centroids")
++              PCoA1       PCoA2       PCoA3      PCoA4
++grazed   -0.1455200  0.07584572 -0.01366220 -0.0178990
++ungrazed  0.2786095 -0.21114993 -0.03475586  0.0220129
++> # eigenvalues from the underlying principal coordinates analysis
++> eigenvals(mod) 
++     PCoA1      PCoA2      PCoA3      PCoA4      PCoA5      PCoA6      PCoA7 
++ 1.7552165  1.1334455  0.4429018  0.3698054  0.2453532  0.1960921  0.1751131 
++     PCoA8      PCoA9     PCoA10     PCoA11     PCoA12     PCoA13     PCoA14 
++ 0.1284467  0.0971594  0.0759601  0.0637178  0.0583225  0.0394934  0.0172699 
++    PCoA15     PCoA16     PCoA17     PCoA18     PCoA19     PCoA20     PCoA21 
++ 0.0051011 -0.0004131 -0.0064654 -0.0133147 -0.0253944 -0.0375105 -0.0480069 
++    PCoA22     PCoA23 
++-0.0537146 -0.0741390 
++> 
++> ## try out bias correction; compare with mod3
++> (mod3B <- betadisper(dis, groups, type = "median", bias.adjust=TRUE))
++
++	Homogeneity of multivariate dispersions
++
++Call: betadisper(d = dis, group = groups, type = "median", bias.adjust
++= TRUE)
++
++No. of Positive Eigenvalues: 15
++No. of Negative Eigenvalues: 8
++
++Average distance to median:
++  grazed ungrazed 
++  0.4055   0.2893 
++
++Eigenvalues for PCoA axes:
++ PCoA1  PCoA2  PCoA3  PCoA4  PCoA5  PCoA6  PCoA7  PCoA8 
++1.7552 1.1334 0.4429 0.3698 0.2454 0.1961 0.1751 0.1284 
++> 
++> ## should always work for a single group
++> group <- factor(rep("grazed", NROW(varespec)))
++> (tmp <- betadisper(dis, group, type = "median"))
++
++	Homogeneity of multivariate dispersions
++
++Call: betadisper(d = dis, group = group, type = "median")
++
++No. of Positive Eigenvalues: 15
++No. of Negative Eigenvalues: 8
++
++Average distance to median:
++grazed 
++0.4255 
++
++Eigenvalues for PCoA axes:
++ PCoA1  PCoA2  PCoA3  PCoA4  PCoA5  PCoA6  PCoA7  PCoA8 
++1.7552 1.1334 0.4429 0.3698 0.2454 0.1961 0.1751 0.1284 
++> (tmp <- betadisper(dis, group, type = "centroid"))
++
++	Homogeneity of multivariate dispersions
++
++Call: betadisper(d = dis, group = group, type = "centroid")
++
++No. of Positive Eigenvalues: 15
++No. of Negative Eigenvalues: 8
++
++Average distance to centroid:
++grazed 
++0.4261 
++
++Eigenvalues for PCoA axes:
++ PCoA1  PCoA2  PCoA3  PCoA4  PCoA5  PCoA6  PCoA7  PCoA8 
++1.7552 1.1334 0.4429 0.3698 0.2454 0.1961 0.1751 0.1284 
++> 
++> ## simulate missing values in 'd' and 'group'
++> ## using spatial medians
++> groups[c(2,20)] <- NA
++> dis[c(2, 20)] <- NA
++> mod2 <- betadisper(dis, groups) ## warnings
++Warning in betadisper(dis, groups) :
++  missing observations due to 'group' removed
++Warning in betadisper(dis, groups) :
++  missing observations due to 'd' removed
++> mod2
++
++	Homogeneity of multivariate dispersions
++
++Call: betadisper(d = dis, group = groups)
++
++No. of Positive Eigenvalues: 14
++No. of Negative Eigenvalues: 5
++
++Average distance to median:
++  grazed ungrazed 
++  0.3984   0.3008 
++
++Eigenvalues for PCoA axes:
++ PCoA1  PCoA2  PCoA3  PCoA4  PCoA5  PCoA6  PCoA7  PCoA8 
++1.4755 0.8245 0.4218 0.3456 0.2159 0.1688 0.1150 0.1060 
++> permutest(mod2, permutations = 99)
++
++Permutation test for homogeneity of multivariate dispersions
++Permutation: free
++Number of permutations: 99
++
++Response: Distances
++          Df   Sum Sq  Mean Sq      F N.Perm Pr(>F)
++Groups     1 0.039979 0.039979 2.4237     99   0.19
++Residuals 18 0.296910 0.016495                     
++> anova(mod2)
++Analysis of Variance Table
++
++Response: Distances
++          Df   Sum Sq  Mean Sq F value Pr(>F)
++Groups     1 0.039979 0.039979  2.4237 0.1369
++Residuals 18 0.296910 0.016495               
++> plot(mod2)
++> boxplot(mod2)
++> plot(TukeyHSD(mod2))
++> 
++> ## Using group centroids
++> mod3 <- betadisper(dis, groups, type = "centroid")
++Warning in betadisper(dis, groups, type = "centroid") :
++  missing observations due to 'group' removed
++Warning in betadisper(dis, groups, type = "centroid") :
++  missing observations due to 'd' removed
++> mod3
++
++	Homogeneity of multivariate dispersions
++
++Call: betadisper(d = dis, group = groups, type = "centroid")
++
++No. of Positive Eigenvalues: 14
++No. of Negative Eigenvalues: 5
++
++Average distance to centroid:
++  grazed ungrazed 
++  0.4001   0.3108 
++
++Eigenvalues for PCoA axes:
++ PCoA1  PCoA2  PCoA3  PCoA4  PCoA5  PCoA6  PCoA7  PCoA8 
++1.4755 0.8245 0.4218 0.3456 0.2159 0.1688 0.1150 0.1060 
++> permutest(mod3, permutations = 99)
++
++Permutation test for homogeneity of multivariate dispersions
++Permutation: free
++Number of permutations: 99
++
++Response: Distances
++          Df   Sum Sq  Mean Sq      F N.Perm Pr(>F)
++Groups     1 0.033468 0.033468 3.1749     99    0.1
++Residuals 18 0.189749 0.010542                     
++> anova(mod3)
++Analysis of Variance Table
++
++Response: Distances
++          Df   Sum Sq  Mean Sq F value  Pr(>F)  
++Groups     1 0.033468 0.033468  3.1749 0.09166 .
++Residuals 18 0.189749 0.010542                  
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> plot(mod3)
++> boxplot(mod3)
++> plot(TukeyHSD(mod3))
++> 
++> 
++> 
++> 
++> cleanEx()
++> nameEx("betadiver")
++> ### * betadiver
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: betadiver
++> ### Title: Indices of beta Diversity
++> ### Aliases: betadiver scores.betadiver plot.betadiver
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> ## Raw data and plotting
++> data(sipoo)
++> m <- betadiver(sipoo)
++> plot(m)
++> ## The indices
++> betadiver(help=TRUE)
++1 "w" = (b+c)/(2*a+b+c)
++2 "-1" = (b+c)/(2*a+b+c)
++3 "c" = (b+c)/2
++4 "wb" = b+c
++5 "r" = 2*b*c/((a+b+c)^2-2*b*c)
++6 "I" = log(2*a+b+c) - 2*a*log(2)/(2*a+b+c) - ((a+b)*log(a+b) +
++(a+c)*log(a+c)) / (2*a+b+c)
++7 "e" = exp(log(2*a+b+c) - 2*a*log(2)/(2*a+b+c) - ((a+b)*log(a+b) +
++(a+c)*log(a+c)) / (2*a+b+c))-1
++8 "t" = (b+c)/(2*a+b+c)
++9 "me" = (b+c)/(2*a+b+c)
++10 "j" = a/(a+b+c)
++11 "sor" = 2*a/(2*a+b+c)
++12 "m" = (2*a+b+c)*(b+c)/(a+b+c)
++13 "-2" = pmin(b,c)/(pmax(b,c)+a)
++14 "co" = (a*c+a*b+2*b*c)/(2*(a+b)*(a+c))
++15 "cc" = (b+c)/(a+b+c)
++16 "g" = (b+c)/(a+b+c)
++17 "-3" = pmin(b,c)/(a+b+c)
++18 "l" = (b+c)/2
++19 "19" = 2*(b*c+1)/(a+b+c)/(a+b+c-1)
++20 "hk" = (b+c)/(2*a+b+c)
++21 "rlb" = a/(a+c)
++22 "sim" = pmin(b,c)/(pmin(b,c)+a)
++23 "gl" = 2*abs(b-c)/(2*a+b+c)
++24 "z" = (log(2)-log(2*a+b+c)+log(a+b+c))/log(2)
++> ## The basic Whittaker index
++> d <- betadiver(sipoo, "w")
++> ## This should be equal to Sorensen index (binary Bray-Curtis in
++> ## vegan)
++> range(d - vegdist(sipoo, binary=TRUE))
++[1] 0 0
++> 
++> 
++> 
++> cleanEx()
++> nameEx("bgdispersal")
++> ### * bgdispersal
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: bgdispersal
++> ### Title: Coefficients of Biogeographical Dispersal Direction
++> ### Aliases: bgdispersal
++> ### Keywords: multivariate nonparametric
++> 
++> ### ** Examples
++> 
++> mat <- matrix(c(32,15,14,10,70,30,100,4,10,30,25,0,18,0,40,
+++   0,0,20,0,0,0,0,4,0,30,20,0,0,0,0,25,74,42,1,45,89,5,16,16,20),
+++   4, 10, byrow=TRUE)
++> bgdispersal(mat)
++$DD1
++      [,1]  [,2] [,3]  [,4]
++[1,]  0.00  0.24 0.21  0.00
++[2,] -0.24  0.00 0.08 -0.24
++[3,] -0.21 -0.08 0.00 -0.21
++[4,]  0.00  0.24 0.21  0.00
++
++$DD2
++           [,1]       [,2]      [,3]       [,4]
++[1,]  0.0000000  0.3428571 0.3230769  0.0000000
++[2,] -0.3428571  0.0000000 0.1142857 -0.3428571
++[3,] -0.3230769 -0.1142857 0.0000000 -0.3230769
++[4,]  0.0000000  0.3428571 0.3230769  0.0000000
++
++$DD3
++            [,1]       [,2]      [,3]        [,4]
++[1,]  0.00000000  0.1567922 0.1420408 -0.01325831
++[2,] -0.15679216  0.0000000 0.1101196 -0.20049485
++[3,] -0.14204082 -0.1101196 0.0000000 -0.13586560
++[4,]  0.01325831  0.2004949 0.1358656  0.00000000
++
++$DD4
++            [,1]       [,2]      [,3]        [,4]
++[1,]  0.00000000  0.2513176 0.2425087 -0.01960102
++[2,] -0.25131757  0.0000000 0.1725441 -0.30993929
++[3,] -0.24250871 -0.1725441 0.0000000 -0.23381521
++[4,]  0.01960102  0.3099393 0.2338152  0.00000000
++
++$McNemar
++     [,1]     [,2]      [,3]     [,4]
++[1,]   NA 7.677938 9.0571232 0.000000
++[2,]   NA       NA 0.2912555 7.677938
++[3,]   NA       NA        NA 9.057123
++[4,]   NA       NA        NA       NA
++
++$prob.McNemar
++     [,1]        [,2]        [,3]        [,4]
++[1,]   NA 0.005590001 0.002616734 1.000000000
++[2,]   NA          NA 0.589417103 0.005590001
++[3,]   NA          NA          NA 0.002616734
++[4,]   NA          NA          NA          NA
++
++> 
++> 
++> 
++> cleanEx()
++> nameEx("bioenv")
++> ### * bioenv
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: bioenv
++> ### Title: Best Subset of Environmental Variables with Maximum (Rank)
++> ###   Correlation with Community Dissimilarities
++> ### Aliases: bioenv bioenv.default bioenv.formula summary.bioenv bioenvdist
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> # The method is very slow for large number of possible subsets.
++> # Therefore only 6 variables in this example.
++> data(varespec)
++> data(varechem)
++> sol <- bioenv(wisconsin(varespec) ~ log(N) + P + K + Ca + pH + Al, varechem)
++> sol
++
++Call:
++bioenv(formula = wisconsin(varespec) ~ log(N) + P + K + Ca +      pH + Al, data = varechem) 
++
++Subset of environmental variables with best correlation to community data.
++
++Correlations:    spearman 
++Dissimilarities: bray 
++Metric:          euclidean 
++
++Best model has 3 parameters (max. 6 allowed):
++P Ca Al
++with correlation  0.4004806 
++
++> summary(sol)
++                    size correlation
++P                      1      0.2513
++P Al                   2      0.4004
++P Ca Al                3      0.4005
++P Ca pH Al             4      0.3619
++log(N) P Ca pH Al      5      0.3216
++log(N) P K Ca pH Al    6      0.2822
++> 
++> 
++> 
++> cleanEx()
++> nameEx("biplot.rda")
++> ### * biplot.rda
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: biplot.rda
++> ### Title: PCA biplot
++> ### Aliases: biplot.rda
++> ### Keywords: hplot
++> 
++> ### ** Examples
++> 
++> data(dune)
++> mod <- rda(dune, scale = TRUE)
++> biplot(mod, scaling = "symmetric")
++> 
++> ## different type for species and site scores
++> biplot(mod, scaling = "symmetric", type = c("text", "points"))
++> 
++> 
++> 
++> cleanEx()
++> nameEx("capscale")
++> ### * capscale
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: capscale
++> ### Title: [Partial] Distance-based Redundancy Analysis
++> ### Aliases: capscale oldCapscale dbrda
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> data(varechem)
++> ## Basic Analysis
++> vare.cap <- capscale(varespec ~ N + P + K + Condition(Al), varechem,
+++                      dist="bray")
++> vare.cap
++Call: capscale(formula = varespec ~ N + P + K + Condition(Al), data =
++varechem, distance = "bray")
++
++              Inertia Proportion Eigenvals Rank
++Total          4.5444     1.0000    4.8034     
++Conditional    0.9726     0.2140    0.9772    1
++Constrained    0.9731     0.2141    0.9972    3
++Unconstrained  2.5987     0.5718    2.8290   15
++Imaginary                          -0.2590    8
++Inertia is squared Bray distance 
++
++Eigenvalues for constrained axes:
++  CAP1   CAP2   CAP3 
++0.5413 0.3265 0.1293 
++
++Eigenvalues for unconstrained axes:
++  MDS1   MDS2   MDS3   MDS4   MDS5   MDS6   MDS7   MDS8   MDS9  MDS10  MDS11 
++0.9065 0.5127 0.3379 0.2626 0.2032 0.1618 0.1242 0.0856 0.0689 0.0583 0.0501 
++ MDS12  MDS13  MDS14  MDS15 
++0.0277 0.0208 0.0073 0.0013 
++
++> plot(vare.cap)
++> anova(vare.cap)
++Permutation test for capscale under reduced model
++Permutation: free
++Number of permutations: 999
++
++Model: capscale(formula = varespec ~ N + P + K + Condition(Al), data = varechem, distance = "bray")
++         Df SumOfSqs      F Pr(>F)   
++Model     3  0.97314 2.3717  0.002 **
++Residual 19  2.59866                 
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> ## Avoid negative eigenvalues with additive constant
++> capscale(varespec ~ N + P + K + Condition(Al), varechem,
+++                      dist="bray", add =TRUE)
++Call: capscale(formula = varespec ~ N + P + K + Condition(Al), data =
++varechem, distance = "bray", add = TRUE)
++
++              Inertia Proportion Rank
++Total          6.2496     1.0000     
++Conditional    1.0468     0.1675    1
++Constrained    1.1956     0.1913    3
++Unconstrained  4.0073     0.6412   19
++Inertia is Lingoes adjusted squared Bray distance 
++
++Eigenvalues for constrained axes:
++  CAP1   CAP2   CAP3 
++0.6103 0.3940 0.1913 
++
++Eigenvalues for unconstrained axes:
++  MDS1   MDS2   MDS3   MDS4   MDS5   MDS6   MDS7   MDS8 
++0.9796 0.5811 0.4077 0.3322 0.2769 0.2346 0.1962 0.1566 
++(Showed only 8 of all 19 unconstrained eigenvalues)
++
++Constant added to distances: 0.07413903 
++
++> ## Avoid negative eigenvalues by taking square roots of dissimilarities
++> capscale(varespec ~ N + P + K + Condition(Al), varechem,
+++                      dist = "bray", sqrt.dist= TRUE)
++Call: capscale(formula = varespec ~ N + P + K + Condition(Al), data =
++varechem, distance = "bray", sqrt.dist = TRUE)
++
++              Inertia Proportion Rank
++Total          6.9500     1.0000     
++Conditional    0.9535     0.1372    1
++Constrained    1.2267     0.1765    3
++Unconstrained  4.7698     0.6863   19
++Inertia is Bray distance 
++
++Eigenvalues for constrained axes:
++  CAP1   CAP2   CAP3 
++0.5817 0.4086 0.2365 
++
++Eigenvalues for unconstrained axes:
++  MDS1   MDS2   MDS3   MDS4   MDS5   MDS6   MDS7   MDS8 
++0.9680 0.6100 0.4469 0.3837 0.3371 0.3012 0.2558 0.2010 
++(Showed only 8 of all 19 unconstrained eigenvalues)
++
++> ## Principal coordinates analysis with extended dissimilarities
++> capscale(varespec ~ 1, dist="bray", metaMDS = TRUE)
++Square root transformation
++Wisconsin double standardization
++Call: capscale(formula = varespec ~ 1, distance = "bray", metaMDSdist =
++TRUE)
++
++               Inertia Eigenvals Rank
++Total          2.54753   2.59500     
++Unconstrained  2.54753   2.59500   19
++Imaginary               -0.04747    4
++Inertia is squared Bray distance 
++
++Eigenvalues for unconstrained axes:
++  MDS1   MDS2   MDS3   MDS4   MDS5   MDS6   MDS7   MDS8 
++0.6075 0.3820 0.3335 0.2046 0.1731 0.1684 0.1505 0.1163 
++(Showed only 8 of all 19 unconstrained eigenvalues)
++
++metaMDSdist transformed data: wisconsin(sqrt(varespec)) 
++
++> ## dbrda
++> dbrda(varespec ~ N + P + K + Condition(Al), varechem,
+++                      dist="bray")
++Call: dbrda(formula = varespec ~ N + P + K + Condition(Al), data =
++varechem, distance = "bray")
++
++              Inertia Proportion Rank RealDims
++Total          4.5444     1.0000              
++Conditional    0.9726     0.2140    1         
++Constrained    0.9731     0.2141    3        3
++Unconstrained  2.5987     0.5718   19       13
++Inertia is squared Bray distance 
++
++Eigenvalues for constrained axes:
++dbRDA1 dbRDA2 dbRDA3 
++0.5362 0.3198 0.1171 
++
++Eigenvalues for unconstrained axes:
++  MDS1   MDS2   MDS3   MDS4   MDS5   MDS6   MDS7   MDS8 
++0.9054 0.5070 0.3336 0.2581 0.2027 0.1605 0.1221 0.0825 
++(Showed only 8 of all 19 unconstrained eigenvalues)
++
++> ## avoid negative eigenvalues also with Jaccard distances
++> dbrda(varespec ~ N + P + K + Condition(Al), varechem,
+++                      dist="jaccard")
++Call: dbrda(formula = varespec ~ N + P + K + Condition(Al), data =
++varechem, distance = "jaccard")
++
++              Inertia Proportion Rank
++Total          6.5044     1.0000     
++Conditional    1.0330     0.1588    1
++Constrained    1.2068     0.1855    3
++Unconstrained  4.2646     0.6557   19
++Inertia is squared Jaccard distance 
++
++Eigenvalues for constrained axes:
++dbRDA1 dbRDA2 dbRDA3 
++0.5992 0.3994 0.2082 
++
++Eigenvalues for unconstrained axes:
++  MDS1   MDS2   MDS3   MDS4   MDS5   MDS6   MDS7   MDS8 
++1.0388 0.6441 0.4518 0.3759 0.3239 0.2785 0.2279 0.1644 
++(Showed only 8 of all 19 unconstrained eigenvalues)
++
++> 
++> 
++> 
++> cleanEx()
++> nameEx("cascadeKM")
++> ### * cascadeKM
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: cascadeKM
++> ### Title: K-means partitioning using a range of values of K
++> ### Aliases: cascadeKM cIndexKM plot.cascadeKM orderingKM pregraphKM
++> ### Keywords: cluster
++> 
++> ### ** Examples
++> 
++>  # Partitioning a (10 x 10) data matrix of random numbers
++>  mat <- matrix(runif(100),10,10)
++>  res <- cascadeKM(mat, 2, 5, iter = 25, criterion = 'calinski') 
++>  toto <- plot(res)
++>  
++>  # Partitioning an autocorrelated time series
++>  vec <- sort(matrix(runif(30),30,1))
++>  res <- cascadeKM(vec, 2, 5, iter = 25, criterion = 'calinski')
++>  toto <- plot(res)
++>  
++>  # Partitioning a large autocorrelated time series
++>  # Note that we remove the grid lines
++>  vec <- sort(matrix(runif(1000),1000,1))
++>  res <- cascadeKM(vec, 2, 7, iter = 10, criterion = 'calinski')
++>  toto <- plot(res, gridcol=NA)
++>  
++> 
++> 
++> 
++> cleanEx()
++> nameEx("cca")
++> ### * cca
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: cca
++> ### Title: [Partial] [Constrained] Correspondence Analysis and Redundancy
++> ###   Analysis
++> ### Aliases: cca cca.default cca.formula rda rda.default rda.formula
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> data(varechem)
++> ## Common but bad way: use all variables you happen to have in your
++> ## environmental data matrix
++> vare.cca <- cca(varespec, varechem)
++> vare.cca
++Call: cca(X = varespec, Y = varechem)
++
++              Inertia Proportion Rank
++Total          2.0832     1.0000     
++Constrained    1.4415     0.6920   14
++Unconstrained  0.6417     0.3080    9
++Inertia is mean squared contingency coefficient 
++
++Eigenvalues for constrained axes:
++  CCA1   CCA2   CCA3   CCA4   CCA5   CCA6   CCA7   CCA8   CCA9  CCA10  CCA11 
++0.4389 0.2918 0.1628 0.1421 0.1180 0.0890 0.0703 0.0584 0.0311 0.0133 0.0084 
++ CCA12  CCA13  CCA14 
++0.0065 0.0062 0.0047 
++
++Eigenvalues for unconstrained axes:
++    CA1     CA2     CA3     CA4     CA5     CA6     CA7     CA8     CA9 
++0.19776 0.14193 0.10117 0.07079 0.05330 0.03330 0.01887 0.01510 0.00949 
++
++> plot(vare.cca)
++> ## Formula interface and a better model
++> vare.cca <- cca(varespec ~ Al + P*(K + Baresoil), data=varechem)
++> vare.cca
++Call: cca(formula = varespec ~ Al + P * (K + Baresoil), data =
++varechem)
++
++              Inertia Proportion Rank
++Total           2.083      1.000     
++Constrained     1.046      0.502    6
++Unconstrained   1.038      0.498   17
++Inertia is mean squared contingency coefficient 
++
++Eigenvalues for constrained axes:
++  CCA1   CCA2   CCA3   CCA4   CCA5   CCA6 
++0.3756 0.2342 0.1407 0.1323 0.1068 0.0561 
++
++Eigenvalues for unconstrained axes:
++    CA1     CA2     CA3     CA4     CA5     CA6     CA7     CA8 
++0.27577 0.15411 0.13536 0.11803 0.08887 0.05511 0.04919 0.03781 
++(Showed only 8 of all 17 unconstrained eigenvalues)
++
++> plot(vare.cca)
++> ## `Partialling out' and `negative components of variance'
++> cca(varespec ~ Ca, varechem)
++Call: cca(formula = varespec ~ Ca, data = varechem)
++
++              Inertia Proportion Rank
++Total         2.08320    1.00000     
++Constrained   0.15722    0.07547    1
++Unconstrained 1.92598    0.92453   22
++Inertia is mean squared contingency coefficient 
++
++Eigenvalues for constrained axes:
++   CCA1 
++0.15722 
++
++Eigenvalues for unconstrained axes:
++   CA1    CA2    CA3    CA4    CA5    CA6    CA7    CA8 
++0.4745 0.2939 0.2140 0.1954 0.1748 0.1171 0.1121 0.0880 
++(Showed only 8 of all 22 unconstrained eigenvalues)
++
++> cca(varespec ~ Ca + Condition(pH), varechem)
++Call: cca(formula = varespec ~ Ca + Condition(pH), data = varechem)
++
++              Inertia Proportion Rank
++Total          2.0832     1.0000     
++Conditional    0.1458     0.0700    1
++Constrained    0.1827     0.0877    1
++Unconstrained  1.7547     0.8423   21
++Inertia is mean squared contingency coefficient 
++
++Eigenvalues for constrained axes:
++   CCA1 
++0.18269 
++
++Eigenvalues for unconstrained axes:
++   CA1    CA2    CA3    CA4    CA5    CA6    CA7    CA8 
++0.3834 0.2749 0.2123 0.1760 0.1701 0.1161 0.1089 0.0880 
++(Showed only 8 of all 21 unconstrained eigenvalues)
++
++> ## RDA
++> data(dune)
++> data(dune.env)
++> dune.Manure <- rda(dune ~ Manure, dune.env)
++> plot(dune.Manure) 
++> 
++> 
++> 
++> cleanEx()
++> nameEx("cca.object")
++> ### * cca.object
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: cca.object
++> ### Title: Result Object from Constrained Ordination with cca, rda or
++> ###   capscale
++> ### Aliases: cca.object
++> ### Keywords: models multivariate
++> 
++> ### ** Examples
++> 
++> # Some species will be missing in the analysis, because only a subset
++> # of sites is used below.
++> data(dune)
++> data(dune.env)
++> mod <- cca(dune[1:15,] ~ ., dune.env[1:15,])
++> # Look at the names of missing species
++> attr(mod$CCA$v, "na.action")
++Airaprae Empenigr Salirepe 
++       3       13       24 
++attr(,"class")
++[1] "exclude"
++> # Look at the names of the aliased variables:
++> mod$CCA$alias
++[1] "Manure^4"
++> # Access directly constrained weighted orthonormal species and site
++> # scores, constrained eigenvalues and margin sums.
++> spec <- mod$CCA$v
++> sites <- mod$CCA$u
++> eig <- mod$CCA$eig
++> rsum <- mod$rowsum
++> csum <- mod$colsum
++> 
++> 
++> 
++> cleanEx()
++> nameEx("clamtest")
++> ### * clamtest
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: clamtest
++> ### Title: Multinomial Species Classification Method (CLAM)
++> ### Aliases: clamtest summary.clamtest plot.clamtest
++> ### Keywords: htest
++> 
++> ### ** Examples
++> 
++> data(mite)
++> data(mite.env)
++> sol <- with(mite.env, clamtest(mite, Shrub=="None", alpha=0.005))
++> summary(sol)
++Two Groups Species Classification Method (CLAM)
++
++Specialization threshold = 0.6666667
++Alpha level = 0.005
++
++Estimated sample coverage:
++ FALSE   TRUE 
++1.0000 0.9996 
++
++Minimum abundance for classification:
++FALSE  TRUE 
++   27     9 
++
++                 Species Proportion
++Generalist            10      0.286
++Specialist_FALSE      14      0.400
++Specialist_TRUE        4      0.114
++Too_rare               7      0.200
++> head(sol)
++  Species Total_FALSE Total_TRUE          Classes
++1  Brachy         534         77       Generalist
++2    PHTH          89          0 Specialist_FALSE
++3    HPAV         389        207       Generalist
++4    RARD          85          0 Specialist_FALSE
++5    SSTR          22          0         Too_rare
++6 Protopl          26          0         Too_rare
++> plot(sol)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("commsim")
++> ### * commsim
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: commsim
++> ### Title: Create an Object for Null Model Algorithms
++> ### Aliases: commsim make.commsim print.commsim
++> ### Keywords: multivariate datagen
++> 
++> ### ** Examples
++> 
++> ## write the r00 algorithm
++> f <- function(x, n, ...) 
+++     array(replicate(n, sample(x)), c(dim(x), n))
++> (cs <- commsim("r00", fun=f, binary=TRUE, 
+++     isSeq=FALSE, mode="integer"))
++An object of class “commsim” 
++‘r00’ method (binary, non-sequential, integer mode)
++
++> 
++> ## retrieving the sequential swap algorithm
++> (cs <- make.commsim("swap"))
++An object of class “commsim” 
++‘swap’ method (binary, sequential, integer mode)
++
++> 
++> ## feeding a commsim object as argument
++> make.commsim(cs)
++An object of class “commsim” 
++‘swap’ method (binary, sequential, integer mode)
++
++> 
++> ## structural constraints
++> diagfun <- function(x, y) {
+++     c(sum = sum(y) == sum(x),
+++         fill = sum(y > 0) == sum(x > 0),
+++         rowSums = all(rowSums(y) == rowSums(x)),
+++         colSums = all(colSums(y) == colSums(x)),
+++         rowFreq = all(rowSums(y > 0) == rowSums(x > 0)),
+++         colFreq = all(colSums(y > 0) == colSums(x > 0)))
+++ }
++> evalfun <- function(meth, x, n) {
+++     m <- nullmodel(x, meth)
+++     y <- simulate(m, nsim=n)
+++     out <- rowMeans(sapply(1:dim(y)[3], 
+++         function(i) diagfun(attr(y, "data"), y[,,i])))
+++     z <- as.numeric(c(attr(y, "binary"), attr(y, "isSeq"),
+++         attr(y, "mode") == "double"))
+++     names(z) <- c("binary", "isSeq", "double")
+++     c(z, out)
+++ }
++> x <- matrix(rbinom(10*12, 1, 0.5)*rpois(10*12, 3), 12, 10)
++> algos <- make.commsim()
++> a <- t(sapply(algos, evalfun, x=x, n=10))
++> print(as.table(ifelse(a==1,1,0)), zero.print = ".")
++                binary isSeq double sum fill rowSums colSums rowFreq colFreq
++r00                  1     .      .   1    1       .       .       .       .
++c0                   1     .      .   1    1       .       1       .       1
++r0                   1     .      .   1    1       1       .       1       .
++r0_old               1     .      .   1    1       1       .       1       .
++r1                   1     .      .   1    1       1       .       1       .
++r2                   1     .      .   1    1       1       .       1       .
++quasiswap            1     .      .   1    1       1       1       1       1
++swap                 1     1      .   1    1       1       1       1       1
++tswap                1     1      .   1    1       1       1       1       1
++curveball            1     1      .   1    1       1       1       1       1
++backtrack            1     .      .   1    1       1       1       1       1
++r2dtable             .     .      .   1    .       1       1       .       .
++swap_count           .     1      .   1    1       1       1       .       .
++quasiswap_count      .     .      .   1    1       1       1       .       .
++swsh_samp            .     .      1   1    1       .       .       1       1
++swsh_both            .     .      .   1    1       .       .       1       1
++swsh_samp_r          .     .      1   1    1       1       .       1       1
++swsh_samp_c          .     .      1   1    1       .       1       1       1
++swsh_both_r          .     .      .   1    1       1       .       1       1
++swsh_both_c          .     .      .   1    1       .       1       1       1
++abuswap_r            .     1      1   1    1       1       .       1       1
++abuswap_c            .     1      1   1    1       .       1       1       1
++r00_samp             .     .      1   1    1       .       .       .       .
++c0_samp              .     .      1   1    1       .       1       .       1
++r0_samp              .     .      1   1    1       1       .       1       .
++r00_ind              .     .      .   1    .       .       .       .       .
++c0_ind               .     .      .   1    .       .       1       .       .
++r0_ind               .     .      .   1    .       1       .       .       .
++r00_both             .     .      .   1    1       .       .       .       .
++c0_both              .     .      .   1    1       .       1       .       1
++r0_both              .     .      .   1    1       1       .       1       .
++> 
++> 
++> 
++> cleanEx()
++> nameEx("contribdiv")
++> ### * contribdiv
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: contribdiv
++> ### Title: Contribution Diversity Approach
++> ### Aliases: contribdiv plot.contribdiv
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> ## Artificial example given in
++> ## Table 2 in Lu et al. 2007
++> x <- matrix(c(
+++ 1/3,1/3,1/3,0,0,0,
+++ 0,0,1/3,1/3,1/3,0,
+++ 0,0,0,1/3,1/3,1/3),
+++ 3, 6, byrow = TRUE,
+++ dimnames = list(LETTERS[1:3],letters[1:6]))
++> x
++          a         b         c         d         e         f
++A 0.3333333 0.3333333 0.3333333 0.0000000 0.0000000 0.0000000
++B 0.0000000 0.0000000 0.3333333 0.3333333 0.3333333 0.0000000
++C 0.0000000 0.0000000 0.0000000 0.3333333 0.3333333 0.3333333
++> ## Compare results with Table 2
++> contribdiv(x, "richness")
++  alpha beta gamma
++A     1  1.5   2.5
++B     1  0.5   1.5
++C     1  1.0   2.0
++> contribdiv(x, "simpson")
++      alpha      beta     gamma
++A 0.6666667 0.1851852 0.8518519
++B 0.6666667 0.1111111 0.7777778
++C 0.6666667 0.1481481 0.8148148
++> ## Relative contribution (C values), compare with Table 2
++> (cd1 <- contribdiv(x, "richness", relative = TRUE, scaled = FALSE))
++  alpha beta gamma
++A     0  0.5   0.5
++B     0 -0.5  -0.5
++C     0  0.0   0.0
++> (cd2 <- contribdiv(x, "simpson", relative = TRUE, scaled = FALSE))
++  alpha        beta       gamma
++A     0  0.03703704  0.03703704
++B     0 -0.03703704 -0.03703704
++C     0  0.00000000  0.00000000
++> ## Differentiation coefficients
++> attr(cd1, "diff.coef") # D_ST
++[1] 0.5
++> attr(cd2, "diff.coef") # D_DT
++[1] 0.1818182
++> ## BCI data set
++> data(BCI)
++> opar <- par(mfrow=c(2,2))
++> plot(contribdiv(BCI, "richness"), main = "Absolute")
++> plot(contribdiv(BCI, "richness", relative = TRUE), main = "Relative")
++> plot(contribdiv(BCI, "simpson"))
++> plot(contribdiv(BCI, "simpson", relative = TRUE))
++> par(opar)
++> 
++> 
++> 
++> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
++> cleanEx()
++> nameEx("decorana")
++> ### * decorana
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: decorana
++> ### Title: Detrended Correspondence Analysis and Basic Reciprocal Averaging
++> ### Aliases: decorana summary.decorana print.summary.decorana plot.decorana
++> ###   downweight scores.decorana points.decorana text.decorana
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> vare.dca <- decorana(varespec)
++> vare.dca
++
++Call:
++decorana(veg = varespec) 
++
++Detrended correspondence analysis with 26 segments.
++Rescaling of axes with 4 iterations.
++
++                  DCA1   DCA2    DCA3    DCA4
++Eigenvalues     0.5235 0.3253 0.20010 0.19176
++Decorana values 0.5249 0.1572 0.09669 0.06075
++Axis lengths    2.8161 2.2054 1.54650 1.64864
++
++> summary(vare.dca)
++
++Call:
++decorana(veg = varespec) 
++
++Detrended correspondence analysis with 26 segments.
++Rescaling of axes with 4 iterations.
++
++                  DCA1   DCA2    DCA3    DCA4
++Eigenvalues     0.5235 0.3253 0.20010 0.19176
++Decorana values 0.5249 0.1572 0.09669 0.06075
++Axis lengths    2.8161 2.2054 1.54650 1.64864
++
++Species scores:
++
++             DCA1     DCA2     DCA3     DCA4 Totals
++Callvulg  0.04119 -1.53268 -2.55101  1.32277  45.07
++Empenigr  0.09019  0.82274  0.20569  0.30631 151.99
++Rhodtome  1.34533  2.47141 -0.34970 -1.13823   8.39
++Vaccmyrt  1.86298  1.71424 -0.60535 -0.40205  50.71
++Vaccviti  0.16641  0.71095  0.00313 -0.55801 275.03
++Pinusylv -0.73490  1.62050 -1.60275 -2.10199   4.11
++Descflex  1.97061  1.81651  1.74896 -0.91463   5.60
++Betupube  0.79745  3.36374 -0.94546 -1.01741   0.29
++Vacculig -0.08912 -1.17478  2.86624  0.87025  15.22
++Diphcomp -0.82669 -0.44195  2.58579 -0.38459   3.24
++Dicrsp    2.37743 -0.27373 -0.47099 -1.89036  40.50
++Dicrfusc  1.58267 -1.33770 -1.33563  1.47417 113.52
++Dicrpoly  0.86689  2.39519 -0.82064 -3.41534   6.06
++Hylosple  2.66242  1.19669  1.48288 -0.69978  18.04
++Pleuschr  1.64098  0.15607  0.30044 -0.26717 377.97
++Polypili -0.56213  0.14009  0.25198  0.49177   0.61
++Polyjuni  1.22244 -0.89173  0.61287  3.60066  13.85
++Polycomm  1.01545  2.08388  0.06402  0.84199   0.71
++Pohlnuta -0.00712  1.09704 -0.82126 -1.59862   2.62
++Ptilcili  0.48093  2.86420 -0.71801 -1.02698  14.01
++Barbhatc  0.58303  3.71792 -0.84212 -1.88837   3.19
++Cladarbu -0.18554 -1.18973  0.68113  0.55399 255.05
++Cladrang -0.83427 -0.78085  0.90603  0.70057 388.71
++Cladstel -1.67768  0.98907 -0.83789 -0.60206 486.71
++Cladunci  0.97686 -1.70859 -1.68281 -2.26756  56.28
++Cladcocc -0.27221 -0.76713 -0.63836  0.66927   2.79
++Cladcorn  0.29068 -0.97039  0.50414  0.95738   6.22
++Cladgrac  0.21778 -0.41879  0.06530 -0.31472   5.14
++Cladfimb  0.00889 -0.23922 -0.26505  0.33123   3.96
++Cladcris  0.37774 -1.09161 -0.55627  0.23868   7.47
++Cladchlo -0.91983  1.54955 -0.58109 -1.48643   1.16
++Cladbotr  0.66438  2.19584 -0.90331 -0.91391   0.47
++Cladamau -0.96418 -0.98992  2.71458  0.52352   0.14
++Cladsp   -1.12318 -0.15330 -0.69833  0.44040   0.52
++Cetreric  0.27163 -1.28867 -0.81682 -1.93935   3.60
++Cetrisla -0.50158  2.22098 -1.16461 -1.89349   2.03
++Flavniva -1.67937 -3.67985  4.15644  3.18919  11.85
++Nepharct  2.18561 -0.82837  0.71958  5.81930   5.26
++Stersp   -0.78699 -2.01214  2.31212  2.03946  17.52
++Peltapht  0.45763 -0.34395  0.09916  1.34695   0.76
++Icmaeric  0.04950 -1.97605  1.41509  2.10154   0.22
++Cladcerv -1.21585 -2.30519  2.55186  3.41532   0.10
++Claddefo  0.60517 -1.19771 -0.33388  0.22585  10.23
++Cladphyl -1.53959  1.48574 -1.43209 -1.52387   0.80
++
++Site scores:
++
++      DCA1    DCA2    DCA3    DCA4 Totals
++18 -0.1729 -0.2841  0.4775  0.2521   89.2
++15  0.8539 -0.3360  0.0708  0.0924   89.8
++24  1.2467 -0.1183 -0.1211 -0.8718   94.2
++27  1.0675  0.4169  0.2897 -0.1758  125.6
++23  0.4234  0.0112  0.2179  0.1265   90.5
++19  0.0252  0.3600 -0.0263 -0.1168   81.3
++22  1.0695 -0.3707 -0.4285  0.4145  109.8
++16  0.7724 -0.5325 -0.2856  0.5269   88.5
++28  1.6189  0.5482  0.2342 -0.3333  110.7
++13 -0.2642 -0.6851 -0.3777  0.5003  101.9
++14  0.6431 -0.9604 -0.6000 -0.2885   81.7
++20  0.4504 -0.1666  0.1850 -0.1291   64.1
++25  1.2501 -0.2248  0.0244  0.3741   94.1
++7  -0.3910 -0.7618  0.8640  0.5557  103.4
++5  -0.6407 -0.9427  0.9465  0.7769   94.8
++6  -0.4523 -0.5529  0.3988  0.2781  110.9
++3  -1.1043  0.2106 -0.0653 -0.0539  106.7
++4  -0.9454 -0.5974  0.4639  0.4889   84.8
++2  -1.1971  0.5691 -0.3246 -0.2522  119.1
++9  -1.0983  0.7850 -0.5274 -0.4848  122.6
++12 -0.8673  0.5621 -0.3254 -0.3217  119.8
++10 -1.1842  0.7442 -0.4995 -0.3917  122.4
++11 -0.4134  0.0260  0.0107 -0.0682  112.8
++21  0.3210  1.2450 -0.2541 -0.5253   99.2
++
++> plot(vare.dca)
++> 
++> ### the detrending rationale:
++> gaussresp <- function(x,u) exp(-(x-u)^2/2)
++> x <- seq(0,6,length=15) ## The gradient
++> u <- seq(-2,8,len=23)   ## The optima
++> pack <- outer(x,u,gaussresp)
++> matplot(x, pack, type="l", main="Species packing")
++> opar <- par(mfrow=c(2,2))
++> plot(scores(prcomp(pack)), asp=1, type="b", main="PCA")
++> plot(scores(decorana(pack, ira=1)), asp=1, type="b", main="CA")
++> plot(scores(decorana(pack)), asp=1, type="b", main="DCA")
++> plot(scores(cca(pack ~ x), dis="sites"), asp=1, type="b", main="CCA")
++> 
++> ### Let's add some noise:
++> noisy <- (0.5 + runif(length(pack)))*pack
++> par(mfrow=c(2,1))
++> matplot(x, pack, type="l", main="Ideal model")
++> matplot(x, noisy, type="l", main="Noisy model")
++> par(mfrow=c(2,2))
++> plot(scores(prcomp(noisy)), type="b", main="PCA", asp=1)
++> plot(scores(decorana(noisy, ira=1)), type="b", main="CA", asp=1)
++> plot(scores(decorana(noisy)), type="b", main="DCA", asp=1)
++> plot(scores(cca(noisy ~ x), dis="sites"), asp=1, type="b", main="CCA")
++> par(opar)
++> 
++> 
++> 
++> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
++> cleanEx()
++> nameEx("decostand")
++> ### * decostand
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: decostand
++> ### Title: Standardization Methods for Community Ecology
++> ### Aliases: decostand wisconsin
++> ### Keywords: multivariate manip
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> sptrans <- decostand(varespec, "max")
++> apply(sptrans, 2, max)
++Callvulg Empenigr Rhodtome Vaccmyrt Vaccviti Pinusylv Descflex Betupube 
++       1        1        1        1        1        1        1        1 
++Vacculig Diphcomp   Dicrsp Dicrfusc Dicrpoly Hylosple Pleuschr Polypili 
++       1        1        1        1        1        1        1        1 
++Polyjuni Polycomm Pohlnuta Ptilcili Barbhatc Cladarbu Cladrang Cladstel 
++       1        1        1        1        1        1        1        1 
++Cladunci Cladcocc Cladcorn Cladgrac Cladfimb Cladcris Cladchlo Cladbotr 
++       1        1        1        1        1        1        1        1 
++Cladamau   Cladsp Cetreric Cetrisla Flavniva Nepharct   Stersp Peltapht 
++       1        1        1        1        1        1        1        1 
++Icmaeric Cladcerv Claddefo Cladphyl 
++       1        1        1        1 
++> sptrans <- wisconsin(varespec)
++> 
++> ## Chi-square: PCA similar but not identical to CA.
++> ## Use wcmdscale for weighted analysis and identical results.
++> sptrans <- decostand(varespec, "chi.square")
++> plot(procrustes(rda(sptrans), cca(varespec)))
++> 
++> 
++> 
++> cleanEx()
++> nameEx("designdist")
++> ### * designdist
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Encoding: UTF-8
++> 
++> ### Name: designdist
++> ### Title: Design your own Dissimilarities
++> ### Aliases: designdist
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(BCI)
++> ## Four ways of calculating the same Sørensen dissimilarity
++> d0 <- vegdist(BCI, "bray", binary = TRUE)
++> d1 <- designdist(BCI, "(A+B-2*J)/(A+B)")
++> d2 <- designdist(BCI, "(b+c)/(2*a+b+c)", abcd = TRUE)
++> d3 <- designdist(BCI, "gamma/alpha - 1", alphagamma = TRUE)
++> ## Arrhenius dissimilarity: the value of z in the species-area model
++> ## S = c*A^z when combining two sites of equal areas, where S is the
++> ## number of species, A is the area, and c and z are model parameters.
++> ## The A below is not the area (which cancels out), but number of
++> ## species in one of the sites, as defined in designdist().
++> dis <- designdist(BCI, "(log(A+B-J)-log(A+B)+log(2))/log(2)")
++> ## This can be used in clustering or ordination...
++> ordiplot(cmdscale(dis))
++Warning in ordiplot(cmdscale(dis)) : Species scores not available
++> ## ... or in analysing beta diversity (without gradients)
++> summary(dis)
++   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
++ 0.2733  0.3895  0.4192  0.4213  0.4537  0.5906 
++>   
++> 
++> 
++> cleanEx()
++> nameEx("deviance.cca")
++> ### * deviance.cca
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: deviance.cca
++> ### Title: Statistics Resembling Deviance and AIC for Constrained
++> ###   Ordination
++> ### Aliases: deviance.cca deviance.rda extractAIC.cca
++> ### Keywords: multivariate models
++> 
++> ### ** Examples
++> 
++> # The deviance of correspondence analysis equals Chi-square
++> data(dune)
++> data(dune.env)
++> chisq.test(dune)
++Warning in chisq.test(dune) :
++  Chi-squared approximation may be incorrect
++
++	Pearson's Chi-squared test
++
++data:  dune
++X-squared = 1449, df = 551, p-value < 2.2e-16
++
++> deviance(cca(dune))
++[1] 1448.956
++> # Stepwise selection (forward from an empty model "dune ~ 1")
++> ord <- cca(dune ~ ., dune.env)
++> step(cca(dune ~ 1, dune.env), scope = formula(ord))
++Start:  AIC=87.66
++dune ~ 1
++
++             Df    AIC
+++ Moisture    3 86.608
+++ Management  3 86.935
+++ A1          1 87.411
++<none>          87.657
+++ Manure      4 88.832
+++ Use         2 89.134
++
++Step:  AIC=86.61
++dune ~ Moisture
++
++             Df    AIC
++<none>          86.608
+++ Management  3 86.813
+++ A1          1 86.992
+++ Use         2 87.259
+++ Manure      4 87.342
++- Moisture    3 87.657
++Call: cca(formula = dune ~ Moisture, data = dune.env)
++
++              Inertia Proportion Rank
++Total          2.1153     1.0000     
++Constrained    0.6283     0.2970    3
++Unconstrained  1.4870     0.7030   16
++Inertia is mean squared contingency coefficient 
++
++Eigenvalues for constrained axes:
++  CCA1   CCA2   CCA3 
++0.4187 0.1330 0.0766 
++
++Eigenvalues for unconstrained axes:
++   CA1    CA2    CA3    CA4    CA5    CA6    CA7    CA8    CA9   CA10   CA11 
++0.4098 0.2259 0.1761 0.1234 0.1082 0.0908 0.0859 0.0609 0.0566 0.0467 0.0419 
++  CA12   CA13   CA14   CA15   CA16 
++0.0201 0.0143 0.0099 0.0085 0.0080 
++
++> 
++> 
++> 
++> cleanEx()
++> nameEx("dispindmorisita")
++> ### * dispindmorisita
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: dispindmorisita
++> ### Title: Morisita index of intraspecific aggregation
++> ### Aliases: dispindmorisita
++> ### Keywords: multivariate spatial
++> 
++> ### ** Examples
++> 
++> data(dune)
++> x <- dispindmorisita(dune)
++> x
++               imor      mclu         muni        imst       pchisq
++Achimill  2.1666667  1.923488  0.327101099  0.50672636 9.157890e-03
++Agrostol  1.8085106  1.294730  0.785245032  0.51373357 1.142619e-05
++Airaprae  8.0000000  4.463082 -1.523370880  0.61382303 3.571702e-04
++Alopgeni  2.5396825  1.395781  0.711614757  0.53074307 3.024441e-08
++Anthodor  2.6666667  1.692616  0.495325824  0.52660266 5.897217e-05
++Bellpere  2.0512821  2.154361  0.158876373  0.45535255 3.451547e-02
++Bromhord  3.2380952  1.989452  0.279036892  0.53466422 1.170437e-04
++Chenalbu        NaN       Inf         -Inf         NaN          NaN
++Cirsarve 20.0000000 14.852327 -9.093483518  1.00000000 5.934709e-03
++Comapalu  6.6666667  5.617442 -2.364494506  0.53647558 1.055552e-02
++Eleopalu  3.7333333  1.577180  0.579438187  0.55851854 2.958285e-10
++Elymrepe  2.7692308  1.554093  0.596260659  0.53293787 1.180195e-06
++Empenigr 20.0000000 14.852327 -9.093483518  1.00000000 5.934709e-03
++Hyporadi  6.6666667  2.731541 -0.261685440  0.61393969 7.832274e-07
++Juncarti  3.1372549  1.814843  0.406265675  0.53635966 2.066336e-05
++Juncbufo  4.1025641  2.154361  0.158876373  0.55458486 1.503205e-05
++Lolipere  1.5849970  1.243023  0.822921342  0.50911591 5.873839e-05
++Planlanc  2.4615385  1.554093  0.596260659  0.52459747 1.921730e-05
++Poaprat   1.1702128  1.294730  0.785245032  0.28876015 1.046531e-01
++Poatriv   1.4644137  1.223425  0.837201879  0.50641728 2.747301e-04
++Ranuflam  2.4175824  2.065564  0.223578191  0.50981405 7.010483e-03
++Rumeacet  3.9215686  1.814843  0.406265675  0.55792432 1.530085e-07
++Sagiproc  2.4210526  1.729070  0.468764025  0.51893672 4.956394e-04
++Salirepe  5.8181818  2.385233 -0.009348352  0.59744520 2.687397e-07
++Scorautu  0.9643606  1.261365  0.809556915 -0.09356972 5.823404e-01
++Trifprat  6.6666667  2.731541 -0.261685440  0.61393969 7.832274e-07
++Trifrepe  1.2210916  1.301138  0.780576445  0.36709402 6.335449e-02
++Vicilath  3.3333333  5.617442 -2.364494506  0.25266513 1.301890e-01
++Bracruta  1.1904762  1.288590  0.789719093  0.33001160 8.071762e-02
++Callcusp  5.3333333  2.539147 -0.121498169  0.58001287 7.982634e-06
++> y <- dispindmorisita(dune, unique.rm = TRUE)
++> y
++              imor     mclu         muni        imst       pchisq
++Achimill 2.1666667 1.923488  0.327101099  0.50672636 9.157890e-03
++Agrostol 1.8085106 1.294730  0.785245032  0.51373357 1.142619e-05
++Airaprae 8.0000000 4.463082 -1.523370880  0.61382303 3.571702e-04
++Alopgeni 2.5396825 1.395781  0.711614757  0.53074307 3.024441e-08
++Anthodor 2.6666667 1.692616  0.495325824  0.52660266 5.897217e-05
++Bellpere 2.0512821 2.154361  0.158876373  0.45535255 3.451547e-02
++Bromhord 3.2380952 1.989452  0.279036892  0.53466422 1.170437e-04
++Comapalu 6.6666667 5.617442 -2.364494506  0.53647558 1.055552e-02
++Eleopalu 3.7333333 1.577180  0.579438187  0.55851854 2.958285e-10
++Elymrepe 2.7692308 1.554093  0.596260659  0.53293787 1.180195e-06
++Hyporadi 6.6666667 2.731541 -0.261685440  0.61393969 7.832274e-07
++Juncarti 3.1372549 1.814843  0.406265675  0.53635966 2.066336e-05
++Juncbufo 4.1025641 2.154361  0.158876373  0.55458486 1.503205e-05
++Lolipere 1.5849970 1.243023  0.822921342  0.50911591 5.873839e-05
++Planlanc 2.4615385 1.554093  0.596260659  0.52459747 1.921730e-05
++Poaprat  1.1702128 1.294730  0.785245032  0.28876015 1.046531e-01
++Poatriv  1.4644137 1.223425  0.837201879  0.50641728 2.747301e-04
++Ranuflam 2.4175824 2.065564  0.223578191  0.50981405 7.010483e-03
++Rumeacet 3.9215686 1.814843  0.406265675  0.55792432 1.530085e-07
++Sagiproc 2.4210526 1.729070  0.468764025  0.51893672 4.956394e-04
++Salirepe 5.8181818 2.385233 -0.009348352  0.59744520 2.687397e-07
++Scorautu 0.9643606 1.261365  0.809556915 -0.09356972 5.823404e-01
++Trifprat 6.6666667 2.731541 -0.261685440  0.61393969 7.832274e-07
++Trifrepe 1.2210916 1.301138  0.780576445  0.36709402 6.335449e-02
++Vicilath 3.3333333 5.617442 -2.364494506  0.25266513 1.301890e-01
++Bracruta 1.1904762 1.288590  0.789719093  0.33001160 8.071762e-02
++Callcusp 5.3333333 2.539147 -0.121498169  0.58001287 7.982634e-06
++> dim(x) ## with unique species
++[1] 30  5
++> dim(y) ## unique species removed
++[1] 27  5
++> 
++> 
++> 
++> cleanEx()
++> nameEx("dispweight")
++> ### * dispweight
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: dispweight
++> ### Title: Dispersion-based weighting of species counts
++> ### Aliases: dispweight gdispweight summary.dispweight
++> ### Keywords: multivariate manip
++> 
++> ### ** Examples
++> 
++> data(mite, mite.env)
++> ## dispweight and its summary
++> mite.dw <- with(mite.env, dispweight(mite, Shrub, nsimul = 99))
++> summary(mite.dw)
++         Dispersion    Weight Df Pr(Disp.)   
++Brachy       9.6908 0.1031909 67      0.01 **
++PHTH         3.2809 0.3047900 49      0.01 **
++HPAV         6.5263 0.1532264 67      0.01 **
++RARD         6.0477 0.1653525 49      0.01 **
++SSTR         2.2619 0.4421053 49      0.01 **
++Protopl      5.4229 0.1844031 49      0.01 **
++MEGR         4.5354 0.2204860 67      0.01 **
++MPRO         1.2687 1.0000000 67      0.07 . 
++TVIE         2.5956 0.3852706 67      0.01 **
++HMIN        10.0714 0.0992906 67      0.01 **
++HMIN2        7.5674 0.1321466 49      0.01 **
++NPRA         2.6743 0.3739344 67      0.01 **
++TVEL         9.6295 0.1038474 49      0.01 **
++ONOV        11.3628 0.0880064 67      0.01 **
++SUCT         8.7372 0.1144533 67      0.01 **
++LCIL       129.4436 0.0077254 67      0.01 **
++Oribatl1     4.1250 0.2424248 67      0.01 **
++Ceratoz1     1.7150 0.5830768 67      0.01 **
++PWIL         2.2943 0.4358538 67      0.01 **
++Galumna1     2.8777 0.3474943 49      0.01 **
++Stgncrs2     3.8242 0.2614953 49      0.01 **
++HRUF         1.7575 0.5690021 67      0.01 **
++Trhypch1    14.9225 0.0670128 67      0.01 **
++PPEL         1.3628 1.0000000 49      0.07 . 
++NCOR         2.5875 0.3864771 67      0.01 **
++SLAT         2.7857 0.3589744 49      0.01 **
++FSET         4.8901 0.2044944 49      0.01 **
++Lepidzts     1.6577 0.6032360 49      0.02 * 
++Eupelops     1.4611 0.6844033 67      0.03 * 
++Miniglmn     1.6505 0.6058733 49      0.01 **
++LRUG        12.0658 0.0828790 67      0.01 **
++PLAG2        3.2403 0.3086090 67      0.01 **
++Ceratoz3     3.5125 0.2846947 67      0.01 **
++Oppiminu     3.1680 0.3156525 67      0.01 **
++Trimalc2    10.5927 0.0944046 67      0.01 **
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++Based on 99 simulations on 'c0_ind' nullmodel
++> ## generalized dispersion weighting
++> mite.dw <- gdispweight(mite ~ Shrub + WatrCont, data = mite.env)
++> rda(mite.dw ~ Shrub + WatrCont, data = mite.env)
++Call: rda(formula = mite.dw ~ Shrub + WatrCont, data = mite.env)
++
++              Inertia Proportion Rank
++Total         38.1640     1.0000     
++Constrained    9.2129     0.2414    3
++Unconstrained 28.9511     0.7586   35
++Inertia is variance 
++
++Eigenvalues for constrained axes:
++ RDA1  RDA2  RDA3 
++7.986 0.748 0.480 
++
++Eigenvalues for unconstrained axes:
++  PC1   PC2   PC3   PC4   PC5   PC6   PC7   PC8 
++5.886 3.634 2.791 2.592 1.932 1.573 1.210 1.078 
++(Showed only 8 of all 35 unconstrained eigenvalues)
++
++> 
++> 
++> 
++> cleanEx()
++> nameEx("distconnected")
++> ### * distconnected
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: distconnected
++> ### Title: Connectedness of Dissimilarities
++> ### Aliases: distconnected no.shared
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> ## There are no disconnected data in vegan, and the following uses an
++> ## extremely low threshold limit for connectedness. This is for
++> ## illustration only, and not a recommended practice.
++> data(dune)
++> dis <- vegdist(dune)
++> gr <- distconnected(dis, toolong=0.4)
++Connectivity of distance matrix with threshold dissimilarity 0.4 
++Data are disconnected: 6 groups
++Groups sizes
++ 1  2  3  4  5  6 
++ 1 11  2  4  1  1 
++> # Make sites with no shared species as NA in Manhattan dissimilarities
++> dis <- vegdist(dune, "manhattan")
++> is.na(dis) <- no.shared(dune)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("diversity")
++> ### * diversity
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: diversity
++> ### Title: Ecological Diversity Indices
++> ### Aliases: diversity fisher.alpha specnumber
++> ### Keywords: univar
++> 
++> ### ** Examples
++> 
++> data(BCI)
++> H <- diversity(BCI)
++> simp <- diversity(BCI, "simpson")
++> invsimp <- diversity(BCI, "inv")
++> ## Unbiased Simpson (Hurlbert 1971, eq. 5) with rarefy:
++> unbias.simp <- rarefy(BCI, 2) - 1
++> ## Fisher alpha
++> alpha <- fisher.alpha(BCI)
++> ## Plot all
++> pairs(cbind(H, simp, invsimp, unbias.simp, alpha), pch="+", col="blue")
++> ## Species richness (S) and Pielou's evenness (J):
++> S <- specnumber(BCI) ## rowSums(BCI > 0) does the same...
++> J <- H/log(S)
++> ## beta diversity defined as gamma/alpha - 1:
++> data(dune)
++> data(dune.env)
++> alpha <- with(dune.env, tapply(specnumber(dune), Management, mean))
++> gamma <- with(dune.env, specnumber(dune, Management))
++> gamma/alpha - 1
++       BF        HF        NM        SF 
++0.5483871 0.6666667 1.6250000 1.2909091 
++> 
++> 
++> 
++> cleanEx()
++> nameEx("dune")
++> ### * dune
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: dune
++> ### Title: Vegetation and Environment in Dutch Dune Meadows.
++> ### Aliases: dune dune.env
++> ### Keywords: datasets
++> 
++> ### ** Examples
++> 
++> data(dune)
++> data(dune.env)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("dune.taxon")
++> ### * dune.taxon
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: dune.taxon
++> ### Title: Taxonomic Classification and Phylogeny of Dune Meadow Species
++> ### Aliases: dune.taxon dune.phylodis
++> ### Keywords: datasets
++> 
++> ### ** Examples
++>  
++>   data(dune.taxon) 
++>   data(dune.phylodis)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("eigenvals")
++> ### * eigenvals
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: eigenvals
++> ### Title: Extract Eigenvalues from an Ordination Object
++> ### Aliases: eigenvals eigenvals.default eigenvals.prcomp
++> ###   eigenvals.princomp eigenvals.cca eigenvals.wcmdscale eigenvals.pcnm
++> ###   eigenvals.dudi eigenvals.pca eigenvals.pco summary.eigenvals
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> data(varechem)
++> mod <- cca(varespec ~ Al + P + K, varechem)
++> ev <- eigenvals(mod)
++> ev
++     CCA1      CCA2      CCA3       CA1       CA2       CA3       CA4       CA5 
++0.3615566 0.1699600 0.1126167 0.3500372 0.2200788 0.1850741 0.1551179 0.1351054 
++      CA6       CA7       CA8       CA9      CA10      CA11      CA12      CA13 
++0.1002670 0.0772991 0.0536938 0.0365603 0.0350887 0.0282291 0.0170651 0.0122474 
++     CA14      CA15      CA16      CA17      CA18      CA19      CA20 
++0.0101910 0.0094701 0.0055090 0.0030529 0.0025118 0.0019485 0.0005178 
++> summary(ev)
++Importance of components:
++                        CCA1    CCA2    CCA3    CA1    CA2     CA3     CA4
++Eigenvalue            0.3616 0.16996 0.11262 0.3500 0.2201 0.18507 0.15512
++Proportion Explained  0.1736 0.08159 0.05406 0.1680 0.1056 0.08884 0.07446
++Cumulative Proportion 0.1736 0.25514 0.30920 0.4772 0.5829 0.67172 0.74618
++                          CA5     CA6     CA7     CA8     CA9    CA10    CA11
++Eigenvalue            0.13511 0.10027 0.07730 0.05369 0.03656 0.03509 0.02823
++Proportion Explained  0.06485 0.04813 0.03711 0.02577 0.01755 0.01684 0.01355
++Cumulative Proportion 0.81104 0.85917 0.89627 0.92205 0.93960 0.95644 0.96999
++                         CA12    CA13    CA14    CA15     CA16     CA17
++Eigenvalue            0.01707 0.01225 0.01019 0.00947 0.005509 0.003053
++Proportion Explained  0.00819 0.00588 0.00489 0.00455 0.002640 0.001470
++Cumulative Proportion 0.97818 0.98406 0.98895 0.99350 0.996140 0.997610
++                          CA18     CA19      CA20
++Eigenvalue            0.002512 0.001948 0.0005178
++Proportion Explained  0.001210 0.000940 0.0002500
++Cumulative Proportion 0.998820 0.999750 1.0000000
++> 
++> 
++> 
++> cleanEx()
++> nameEx("envfit")
++> ### * envfit
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: envfit
++> ### Title: Fits an Environmental Vector or Factor onto an Ordination
++> ### Aliases: envfit envfit.default envfit.formula vectorfit factorfit
++> ###   plot.envfit scores.envfit labels.envfit
++> ### Keywords: multivariate aplot htest
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> data(varechem)
++> library(MASS)
++> ord <- metaMDS(varespec)
++Square root transformation
++Wisconsin double standardization
++Run 0 stress 0.1843196 
++Run 1 stress 0.2455912 
++Run 2 stress 0.2169407 
++Run 3 stress 0.2313231 
++Run 4 stress 0.1974406 
++Run 5 stress 0.1858402 
++Run 6 stress 0.1948414 
++Run 7 stress 0.2265717 
++Run 8 stress 0.222507 
++Run 9 stress 0.2023215 
++Run 10 stress 0.2673177 
++Run 11 stress 0.1976151 
++Run 12 stress 0.1852397 
++Run 13 stress 0.2341085 
++Run 14 stress 0.1955867 
++Run 15 stress 0.2137409 
++Run 16 stress 0.2109638 
++Run 17 stress 0.1825658 
++... New best solution
++... Procrustes: rmse 0.04169825  max resid 0.1521436 
++Run 18 stress 0.1843197 
++Run 19 stress 0.2570119 
++Run 20 stress 0.3760596 
++*** No convergence -- monoMDS stopping criteria:
++    20: stress ratio > sratmax
++> (fit <- envfit(ord, varechem, perm = 999))
++
++***VECTORS
++
++            NMDS1    NMDS2     r2 Pr(>r)    
++N        -0.05719 -0.99836 0.2537  0.039 *  
++P         0.61959  0.78492 0.1938  0.129    
++K         0.76629  0.64249 0.1809  0.138    
++Ca        0.68506  0.72849 0.4119  0.005 ** 
++Mg        0.63240  0.77464 0.4271  0.005 ** 
++S         0.19123  0.98155 0.1752  0.133    
++Al       -0.87169  0.49006 0.5269  0.001 ***
++Fe       -0.93613  0.35164 0.4451  0.001 ***
++Mn        0.79873 -0.60169 0.5230  0.002 ** 
++Zn        0.61750  0.78657 0.1879  0.122    
++Mo       -0.90304  0.42955 0.0609  0.524    
++Baresoil  0.92503 -0.37988 0.2508  0.043 *  
++Humdepth  0.93291 -0.36011 0.5200  0.001 ***
++pH       -0.64809  0.76156 0.2308  0.064 .  
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++Permutation: free
++Number of permutations: 999
++
++
++> scores(fit, "vectors")
++               NMDS1      NMDS2
++N        -0.02880854 -0.5028710
++P         0.27276629  0.3455503
++K         0.32594190  0.2732833
++Ca        0.43965251  0.4675260
++Mg        0.41327822  0.5062343
++S         0.08004855  0.4108725
++Al       -0.63277161  0.3557376
++Fe       -0.62453266  0.2345938
++Mn        0.57765765 -0.4351493
++Zn        0.26766914  0.3409611
++Mo       -0.22292390  0.1060370
++Baresoil  0.46323932 -0.1902392
++Humdepth  0.67274437 -0.2596855
++pH       -0.31133604  0.3658438
++> plot(ord)
++> plot(fit)
++> plot(fit, p.max = 0.05, col = "red")
++> ## Adding fitted arrows to CCA. We use "lc" scores, and hope
++> ## that arrows are scaled similarly in cca and envfit plots
++> ord <- cca(varespec ~ Al + P + K, varechem)
++> plot(ord, type="p")
++> fit <- envfit(ord, varechem, perm = 999, display = "lc")
++> plot(fit, p.max = 0.05, col = "red")
++> 
++> ## Class variables, formula interface, and displaying the
++> ## inter-class variability with `ordispider', and semitransparent
++> ## white background for labels (semitransparent colours are not
++> ## supported by all graphics devices)
++> data(dune)
++> data(dune.env)
++> attach(dune.env)
++> ord <- cca(dune)
++> fit <- envfit(ord ~ Moisture + A1, dune.env, perm = 0)
++> plot(ord, type = "n")
++> ordispider(ord, Moisture, col="skyblue")
++> points(ord, display = "sites", col = as.numeric(Moisture), pch=16)
++> plot(fit, cex=1.2, axis=TRUE, bg = rgb(1, 1, 1, 0.5))
++> ## Use shorter labels for factor centroids
++> labels(fit)
++$vectors
++[1] "A1"
++
++$factors
++[1] "Moisture1" "Moisture2" "Moisture4" "Moisture5"
++
++> plot(ord)
++> plot(fit, labels=list(factors = paste("M", c(1,2,4,5), sep = "")),
+++    bg = rgb(1,1,0,0.5))
++> detach(dune.env)
++> 
++> 
++> 
++> cleanEx()
++
++detaching ‘package:MASS’
++
++> nameEx("eventstar")
++> ### * eventstar
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: eventstar
++> ### Title: Scale Parameter at the Minimum of the Tsallis Evenness Profile
++> ### Aliases: eventstar
++> ### Keywords: optimize multivariate utilities
++> 
++> ### ** Examples
++> 
++> data(BCI)
++> (x <- eventstar(BCI[1:5,]))
++      qstar     Estar     Hstar    Dstar
++1 0.6146389 0.4263687 10.524584 67.03551
++2 0.6249249 0.4080263  9.534034 57.66840
++3 0.6380858 0.4062032  9.225458 57.69174
++4 0.6245808 0.4062213 10.140189 65.50247
++5 0.6404825 0.4219957  9.828138 66.96440
++> ## profiling
++> y <- as.numeric(BCI[10,])
++> (z <- eventstar(y))
++      qstar     Estar    Hstar    Dstar
++1 0.6372529 0.4117557 9.546332 61.77715
++> q <- seq(0, 2, 0.05)
++> Eprof <- tsallis(y, scales=q, norm=TRUE)
++> Hprof <- tsallis(y, scales=q)
++> Dprof <- tsallis(y, scales=q, hill=TRUE)
++> opar <- par(mfrow=c(3,1))
++> plot(q, Eprof, type="l", main="Evenness")
++> abline(v=z$qstar, h=tsallis(y, scales=z$qstar, norm=TRUE), col=2)
++> plot(q, Hprof, type="l", main="Diversity")
++> abline(v=z$qstar, h=tsallis(y, scales=z$qstar), col=2)
++> plot(q, Dprof, type="l", main="Effective number of species")
++> abline(v=z$qstar, h=tsallis(y, scales=z$qstar, hill=TRUE), col=2)
++> par(opar)
++> 
++> 
++> 
++> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
++> cleanEx()
++> nameEx("fisherfit")
++> ### * fisherfit
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: fisherfit
++> ### Title: Fit Fisher's Logseries and Preston's Lognormal Model to
++> ###   Abundance Data
++> ### Aliases: fisherfit as.fisher plot.fisherfit prestonfit prestondistr
++> ###   as.preston plot.prestonfit lines.prestonfit plot.preston
++> ###   lines.preston plot.fisher veiledspec
++> ### Keywords: univar distribution
++> 
++> ### ** Examples
++> 
++> data(BCI)
++> mod <- fisherfit(BCI[5,])
++> mod
++
++Fisher log series model
++No. of species: 101 
++Fisher alpha:   37.96423 
++
++> # prestonfit seems to need large samples
++> mod.oct <- prestonfit(colSums(BCI))
++> mod.ll <- prestondistr(colSums(BCI))
++> mod.oct
++
++Preston lognormal model
++Method: Quasi-Poisson fit to octaves 
++No. of species: 225 
++
++     mode     width        S0 
++ 4.885798  2.932690 32.022923 
++
++Frequencies by Octave
++                0        1        2      3        4        5        6        7
++Observed 9.500000 16.00000 18.00000 19.000 30.00000 35.00000 31.00000 26.50000
++Fitted   7.994154 13.31175 19.73342 26.042 30.59502 31.99865 29.79321 24.69491
++                8        9       10     11
++Observed 18.00000 13.00000 7.000000 2.0000
++Fitted   18.22226 11.97021 7.000122 3.6443
++
++> mod.ll
++
++Preston lognormal model
++Method: maximized likelihood to log2 abundances 
++No. of species: 225 
++
++     mode     width        S0 
++ 4.365002  2.753531 33.458185 
++
++Frequencies by Octave
++               0        1        2        3        4        5        6        7
++Observed 9.50000 16.00000 18.00000 19.00000 30.00000 35.00000 31.00000 26.50000
++Fitted   9.52392 15.85637 23.13724 29.58961 33.16552 32.58022 28.05054 21.16645
++                8         9       10      11
++Observed 18.00000 13.000000 7.000000 2.00000
++Fitted   13.99829  8.113746 4.121808 1.83516
++
++> plot(mod.oct)  
++> lines(mod.ll, line.col="blue3") # Different
++> ## Smoothed density
++> den <- density(log2(colSums(BCI)))
++> lines(den$x, ncol(BCI)*den$y, lwd=2) # Fairly similar to mod.oct
++> ## Extrapolated richness
++> veiledspec(mod.oct)
++Extrapolated     Observed       Veiled 
++   235.40577    225.00000     10.40577 
++> veiledspec(mod.ll)
++Extrapolated     Observed       Veiled 
++  230.931018   225.000000     5.931018 
++> 
++> 
++> 
++> cleanEx()
++> nameEx("goodness.cca")
++> ### * goodness.cca
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: goodness.cca
++> ### Title: Diagnostic Tools for [Constrained] Ordination (CCA, RDA, DCA,
++> ###   CA, PCA)
++> ### Aliases: goodness goodness.cca inertcomp spenvcor intersetcor vif.cca
++> ###   alias.cca
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(dune)
++> data(dune.env)
++> mod <- cca(dune ~ A1 + Management + Condition(Moisture), data=dune.env)
++> goodness(mod, addprevious = TRUE)
++               CCA1      CCA2      CCA3      CCA4
++Achimill 0.36630013 0.3822685 0.3838616 0.4934158
++Agrostol 0.67247051 0.6724758 0.6779597 0.7773267
++Airaprae 0.36213737 0.3698100 0.3816619 0.3908018
++Alopgeni 0.61547145 0.6966105 0.7042650 0.7212918
++Anthodor 0.24619147 0.2795001 0.3509172 0.3609709
++Bellpere 0.41185412 0.4179432 0.4847618 0.4849622
++Bromhord 0.33487622 0.3397416 0.3870032 0.5505037
++Chenalbu 0.23594716 0.2684323 0.2828928 0.2885321
++Cirsarve 0.29041563 0.3013655 0.3080671 0.3591280
++Comapalu 0.16338257 0.6836790 0.7390659 0.7963425
++Eleopalu 0.55132024 0.6099415 0.6193301 0.6259818
++Elymrepe 0.25239595 0.2710266 0.2761491 0.2882666
++Empenigr 0.27089495 0.3132399 0.3153052 0.3154203
++Hyporadi 0.31349648 0.3371809 0.3387669 0.3388716
++Juncarti 0.43923609 0.4492937 0.4871043 0.5224072
++Juncbufo 0.70439967 0.7226263 0.7228786 0.7257471
++Lolipere 0.48141171 0.5720410 0.5727299 0.6034007
++Planlanc 0.54969676 0.6084389 0.6802195 0.6826265
++Poaprat  0.40267189 0.4944813 0.5014516 0.5326546
++Poatriv  0.49694972 0.5409439 0.5468830 0.5594817
++Ranuflam 0.68677962 0.6983001 0.7020461 0.7064850
++Rumeacet 0.44788204 0.5211145 0.7673956 0.7691199
++Sagiproc 0.27039747 0.3497634 0.3553109 0.3613746
++Salirepe 0.64788354 0.7264891 0.7276110 0.7639711
++Scorautu 0.54312496 0.5510319 0.6078931 0.6140593
++Trifprat 0.37328840 0.4101104 0.6624199 0.6625703
++Trifrepe 0.03048149 0.2115857 0.3300132 0.4207437
++Vicilath 0.17824132 0.1784611 0.3762406 0.4279428
++Bracruta 0.15585567 0.1641095 0.1672797 0.2449864
++Callcusp 0.30771429 0.3143582 0.3308502 0.3518027
++> goodness(mod, addprevious = TRUE, summ = TRUE)
++ Achimill  Agrostol  Airaprae  Alopgeni  Anthodor  Bellpere  Bromhord  Chenalbu 
++0.4934158 0.7773267 0.3908018 0.7212918 0.3609709 0.4849622 0.5505037 0.2885321 
++ Cirsarve  Comapalu  Eleopalu  Elymrepe  Empenigr  Hyporadi  Juncarti  Juncbufo 
++0.3591280 0.7963425 0.6259818 0.2882666 0.3154203 0.3388716 0.5224072 0.7257471 
++ Lolipere  Planlanc   Poaprat   Poatriv  Ranuflam  Rumeacet  Sagiproc  Salirepe 
++0.6034007 0.6826265 0.5326546 0.5594817 0.7064850 0.7691199 0.3613746 0.7639711 
++ Scorautu  Trifprat  Trifrepe  Vicilath  Bracruta  Callcusp 
++0.6140593 0.6625703 0.4207437 0.4279428 0.2449864 0.3518027 
++> # Inertia components
++> inertcomp(mod, prop = TRUE)
++               pCCA        CCA        CA
++Achimill 0.34271900 0.15069678 0.5065842
++Agrostol 0.55602406 0.22130269 0.2226733
++Airaprae 0.06404726 0.32675457 0.6091982
++Alopgeni 0.34238968 0.37890210 0.2787082
++Anthodor 0.10259139 0.25837947 0.6390291
++Bellpere 0.40972447 0.07523776 0.5150378
++Bromhord 0.33046684 0.22003683 0.4494963
++Chenalbu 0.11064346 0.17788865 0.7114679
++Cirsarve 0.26649913 0.09262886 0.6408720
++Comapalu 0.16096277 0.63537969 0.2036575
++Eleopalu 0.53954819 0.08643366 0.3740182
++Elymrepe 0.22234322 0.06592337 0.7117334
++Empenigr 0.10361994 0.21180040 0.6845797
++Hyporadi 0.03889627 0.29997533 0.6611284
++Juncarti 0.43439190 0.08801527 0.4775928
++Juncbufo 0.66622672 0.05952038 0.2742529
++Lolipere 0.46273045 0.14067027 0.3965993
++Planlanc 0.51993753 0.16268893 0.3173735
++Poaprat  0.39408053 0.13857406 0.4673454
++Poatriv  0.05598349 0.50349824 0.4405183
++Ranuflam 0.68509904 0.02138594 0.2935150
++Rumeacet 0.40125987 0.36786003 0.2308801
++Sagiproc 0.26050435 0.10087025 0.6386254
++Salirepe 0.12527838 0.63869277 0.2360289
++Scorautu 0.10895437 0.50510492 0.3859407
++Trifprat 0.34544815 0.31712212 0.3374297
++Trifrepe 0.02132183 0.39942191 0.5792563
++Vicilath 0.12125433 0.30668844 0.5720572
++Bracruta 0.07222706 0.17275938 0.7550136
++Callcusp 0.29447422 0.05732850 0.6481973
++> inertcomp(mod, stat="d")
++               pCCA        CCA         CA
++Achimill 0.74393575 0.32711556  1.0996359
++Agrostol 0.65154706 0.25932172  0.2609277
++Airaprae 0.91341031 4.66001211  8.6880830
++Alopgeni 0.62026287 0.68640768  0.5048995
++Anthodor 0.31403667 0.79091068  1.9560957
++Bellpere 0.81483759 0.14962874  1.0242789
++Bromhord 0.82257902 0.54770300  1.1188603
++Chenalbu 2.18604651 3.51464840 14.0568809
++Cirsarve 3.79020979 1.31738817  9.1146243
++Comapalu 2.18604651 8.62913533  2.7658870
++Eleopalu 2.18604651 0.35019669  1.5153810
++Elymrepe 0.51093664 0.15148951  1.6355375
++Empenigr 2.18604651 4.46830527 14.4424224
++Hyporadi 0.35520990 2.73944513  6.0375798
++Juncarti 1.36667524 0.27691192  1.5025932
++Juncbufo 2.60346194 0.23259205  1.0717177
++Lolipere 0.43502729 0.13224850  0.3728553
++Planlanc 0.96463794 0.30183609  0.5888218
++Poaprat  0.20406096 0.07175578  0.2419987
++Poatriv  0.03136359 0.28207442  0.2467912
++Ranuflam 2.18604651 0.06823926  0.9365617
++Rumeacet 1.09684464 1.00554611  0.6311112
++Sagiproc 0.51772816 0.20047024  1.2692085
++Salirepe 0.88898328 4.53220433  1.6748757
++Scorautu 0.03887246 0.18021004  0.1376949
++Trifprat 1.74000000 1.59732360  1.6996117
++Trifrepe 0.01215418 0.22768437  0.3301962
++Vicilath 0.84063811 2.12622500  3.9659871
++Bracruta 0.04517898 0.10806328  0.4722710
++Callcusp 2.18604651 0.42558147  4.8119302
++> # vif.cca 
++> vif.cca(mod)
++  Moisture.L   Moisture.Q   Moisture.C           A1 ManagementHF ManagementNM 
++    1.504327     1.284489     1.347660     1.367328     2.238653     2.570972 
++ManagementSF 
++    2.424444 
++> # Aliased constraints
++> mod <- cca(dune ~ ., dune.env)
++> mod
++Call: cca(formula = dune ~ A1 + Moisture + Management + Use + Manure,
++data = dune.env)
++
++              Inertia Proportion Rank
++Total          2.1153     1.0000     
++Constrained    1.5032     0.7106   12
++Unconstrained  0.6121     0.2894    7
++Inertia is mean squared contingency coefficient 
++Some constraints were aliased because they were collinear (redundant)
++
++Eigenvalues for constrained axes:
++  CCA1   CCA2   CCA3   CCA4   CCA5   CCA6   CCA7   CCA8   CCA9  CCA10  CCA11 
++0.4671 0.3410 0.1761 0.1532 0.0953 0.0703 0.0589 0.0499 0.0318 0.0260 0.0228 
++ CCA12 
++0.0108 
++
++Eigenvalues for unconstrained axes:
++    CA1     CA2     CA3     CA4     CA5     CA6     CA7 
++0.27237 0.10876 0.08975 0.06305 0.03489 0.02529 0.01798 
++
++> vif.cca(mod)
++          A1   Moisture.L   Moisture.Q   Moisture.C ManagementHF ManagementNM 
++    2.208249     2.858927     3.072715     3.587087     6.608315   142.359372 
++ManagementSF        Use.L        Use.Q     Manure.L     Manure.Q     Manure.C 
++   12.862713     2.642718     3.007238    80.828330    49.294455    21.433337 
++    Manure^4 
++          NA 
++> alias(mod)
++Model :
++dune ~ A1 + Moisture + Management + Use + Manure
++
++Complete :
++         A1 Moisture.L Moisture.Q Moisture.C ManagementHF ManagementNM
++Manure^4                                                   8.366600   
++         ManagementSF Use.L Use.Q Manure.L  Manure.Q  Manure.C 
++Manure^4                           5.291503 -4.472136  2.645751
++
++> with(dune.env, table(Management, Manure))
++          Manure
++Management 0 1 2 3 4
++        BF 0 2 1 0 0
++        HF 0 1 2 2 0
++        NM 6 0 0 0 0
++        SF 0 0 1 2 3
++> # The standard correlations (not recommended)
++> spenvcor(mod)
++     CCA1      CCA2      CCA3      CCA4      CCA5      CCA6      CCA7      CCA8 
++0.9636021 0.9486511 0.9330434 0.8734524 0.9374495 0.8362375 0.9748848 0.8392780 
++     CCA9     CCA10     CCA11     CCA12 
++0.8747389 0.6096594 0.6637148 0.7579916 
++> intersetcor(mod)
++                   CCA1        CCA2        CCA3         CCA4        CCA5
++A1           -0.5321996 -0.13912207 -0.48150939 -0.259433707  0.09911786
++Moisture.L   -0.8785172 -0.18040189  0.03644505  0.182602811  0.09837305
++Moisture.Q   -0.1946874  0.32977037 -0.27391819 -0.180009911 -0.26613363
++Moisture.C   -0.2019848  0.09650383  0.28577179 -0.261556870  0.49109525
++ManagementHF  0.3451922 -0.01403625 -0.51180235  0.193533258 -0.30824886
++ManagementNM -0.5683132  0.61018732  0.14614372 -0.012375462 -0.04575256
++ManagementSF -0.1197518 -0.64162158  0.19778688  0.134961914  0.09680582
++Use.L        -0.1875733 -0.33013591 -0.30944066 -0.372831885 -0.09587365
++Use.Q        -0.1814760  0.48858573 -0.02033145 -0.009560403 -0.04810528
++Manure.L      0.3156026 -0.65867454  0.03849174 -0.026284481  0.04074238
++Manure.Q     -0.4052775  0.20889368  0.49284523 -0.175984063 -0.11995731
++Manure.C      0.4667289 -0.11239457  0.29234452 -0.174073605 -0.14234406
++Manure^4      0.2220470  0.12845556 -0.12903663  0.108230657  0.02558063
++                    CCA6        CCA7        CCA8        CCA9        CCA10
++A1           -0.15308984 -0.25797100 -0.19234827  0.27570098 -0.116893686
++Moisture.L   -0.02975258 -0.07850852  0.10802259 -0.07239493  0.094640487
++Moisture.Q   -0.11254617 -0.05055234  0.48336992 -0.06243695 -0.205959907
++Moisture.C   -0.23606190  0.38701844  0.10155264  0.21874286  0.187345861
++ManagementHF -0.24233160 -0.16420200  0.14035917 -0.30903312  0.132635464
++ManagementNM -0.06594907 -0.23981367 -0.14368858  0.26879033 -0.001606144
++ManagementSF -0.01616968  0.49727982 -0.08071454  0.30247100 -0.138224363
++Use.L         0.19132865  0.44624441  0.18449673 -0.12952535  0.045337916
++Use.Q         0.13464687 -0.10362907  0.11033206 -0.41344859 -0.077048641
++Manure.L     -0.22218417  0.49678602  0.16957558  0.04161905 -0.003418114
++Manure.Q     -0.19580363  0.12001390 -0.17608393  0.43863133  0.089074448
++Manure.C      0.14824215 -0.07859941 -0.37823472 -0.10058265  0.106319365
++Manure^4     -0.36675058 -0.05957188 -0.40937365  0.06097317 -0.149858571
++                   CCA11       CCA12
++A1            0.03742925  0.08998648
++Moisture.L   -0.06274844  0.08674397
++Moisture.Q    0.21943291 -0.16867562
++Moisture.C   -0.13658737  0.14298295
++ManagementHF -0.17603113 -0.13480899
++ManagementNM  0.01749194 -0.09355925
++ManagementSF  0.01483251  0.06624422
++Use.L         0.08583483 -0.32574274
++Use.Q        -0.41869776 -0.04845019
++Manure.L     -0.02629234 -0.13200710
++Manure.Q     -0.12708874 -0.06972694
++Manure.C     -0.05332901  0.41503090
++Manure^4      0.41602035 -0.01685222
++> 
++> 
++> 
++> cleanEx()
++> nameEx("goodness.metaMDS")
++> ### * goodness.metaMDS
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: goodness.metaMDS
++> ### Title: Goodness of Fit and Shepard Plot for Nonmetric Multidimensional
++> ###   Scaling
++> ### Aliases: goodness.metaMDS goodness.monoMDS stressplot
++> ###   stressplot.default stressplot.monoMDS
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> mod <- metaMDS(varespec)
++Square root transformation
++Wisconsin double standardization
++Run 0 stress 0.1843196 
++Run 1 stress 0.2455912 
++Run 2 stress 0.2169407 
++Run 3 stress 0.2313231 
++Run 4 stress 0.1974406 
++Run 5 stress 0.1858402 
++Run 6 stress 0.1948414 
++Run 7 stress 0.2265717 
++Run 8 stress 0.222507 
++Run 9 stress 0.2023215 
++Run 10 stress 0.2673177 
++Run 11 stress 0.1976151 
++Run 12 stress 0.1852397 
++Run 13 stress 0.2341085 
++Run 14 stress 0.1955867 
++Run 15 stress 0.2137409 
++Run 16 stress 0.2109638 
++Run 17 stress 0.1825658 
++... New best solution
++... Procrustes: rmse 0.04169825  max resid 0.1521436 
++Run 18 stress 0.1843197 
++Run 19 stress 0.2570119 
++Run 20 stress 0.3760596 
++*** No convergence -- monoMDS stopping criteria:
++    20: stress ratio > sratmax
++> stressplot(mod)
++> gof <- goodness(mod)
++> gof
++ [1] 0.02984480 0.03513719 0.04188277 0.04598591 0.04003418 0.03441705
++ [7] 0.03294386 0.03050002 0.03060565 0.02993891 0.03526891 0.02621276
++[13] 0.03831284 0.02980754 0.03370603 0.02225802 0.03561193 0.03505161
++[19] 0.06577544 0.03268484 0.03503582 0.02956571 0.05167231 0.04602312
++> plot(mod, display = "sites", type = "n")
++> points(mod, display = "sites", cex = 2*gof/mean(gof))
++> 
++> 
++> 
++> cleanEx()
++> nameEx("humpfit")
++> ### * humpfit
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: humpfit
++> ### Title: No-interaction Model for Hump-backed Species Richness vs.
++> ###   Biomass
++> ### Aliases: humpfit summary.humpfit lines.humpfit plot.humpfit
++> ###   points.humpfit predict.humpfit profile.humpfit
++> ### Keywords: models regression nonlinear
++> 
++> ### ** Examples
++> 
++> ##
++> ## Data approximated from Al-Mufti et al. (1977)
++> ##
++> 
++> 
++> 
++> cleanEx()
++> nameEx("indpower")
++> ### * indpower
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: indpower
++> ### Title: Indicator Power of Species
++> ### Aliases: indpower
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(dune)
++> ## IP values
++> ip <- indpower(dune)
++> ## and TIP values
++> diag(ip) <- NA
++> (TIP <- rowMeans(ip, na.rm=TRUE))
++i.Achimill i.Agrostol i.Airaprae i.Alopgeni i.Anthodor i.Bellpere i.Bromhord 
++ 0.3186250  0.3342800  0.2168133  0.3416198  0.3567884  0.3432281  0.3665632 
++i.Chenalbu i.Cirsarve i.Comapalu i.Eleopalu i.Elymrepe i.Empenigr i.Hyporadi 
++ 0.2095044  0.2781640  0.1713273  0.2414787  0.3263516  0.2016196  0.2378197 
++i.Juncarti i.Juncbufo i.Lolipere i.Planlanc  i.Poaprat  i.Poatriv i.Ranuflam 
++ 0.2915850  0.3331330  0.3998442  0.3426064  0.4094319  0.3929520  0.2663080 
++i.Rumeacet i.Sagiproc i.Salirepe i.Scorautu i.Trifprat i.Trifrepe i.Vicilath 
++ 0.3484684  0.3788905  0.2898512  0.4362493  0.3145854  0.4503764  0.2605349 
++i.Bracruta i.Callcusp 
++ 0.4252676  0.2070766 
++> 
++> ## p value calculation for a species
++> ## from Halme et al. 2009
++> ## i is ID for the species
++> i <- 1
++> fun <- function(x, i) indpower(x)[i,-i]
++> ## 'c0' randomizes species occurrences
++> os <- oecosimu(dune, fun, "c0", i=i, nsimul=99)
++Warning in oecosimu(dune, fun, "c0", i = i, nsimul = 99) :
++  nullmodel transformed 'comm' to binary data
++> ## get z values from oecosimu output
++> z <- os$oecosimu$z
++> ## p-value
++> (p <- sum(z) / sqrt(length(z)))
++[1] -2.051592
++> ## 'heterogeneity' measure
++> (chi2 <- sum((z - mean(z))^2))
++[1] 100.6288
++> pchisq(chi2, df=length(z)-1)
++[1] 1
++> ## Halme et al.'s suggested output
++> out <- c(TIP=TIP[i], 
+++     significance=p,
+++     heterogeneity=chi2,
+++     minIP=min(fun(dune, i=i)),
+++     varIP=sd(fun(dune, i=i)^2))
++> out
++TIP.i.Achimill   significance  heterogeneity          minIP          varIP 
++     0.3186250     -2.0515917    100.6288432      0.0000000      0.2142097 
++> 
++> 
++> 
++> cleanEx()
++> nameEx("isomap")
++> ### * isomap
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: isomap
++> ### Title: Isometric Feature Mapping Ordination
++> ### Aliases: isomap isomapdist plot.isomap summary.isomap
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> ## The following examples also overlay minimum spanning tree to
++> ## the graphics in red.
++> op <- par(mar=c(4,4,1,1)+0.2, mfrow=c(2,2))
++> data(BCI)
++> dis <- vegdist(BCI)
++> tr <- spantree(dis)
++> pl <- ordiplot(cmdscale(dis), main="cmdscale")
++Warning in ordiplot(cmdscale(dis), main = "cmdscale") :
++  Species scores not available
++> lines(tr, pl, col="red")
++> ord <- isomap(dis, k=3)
++> ord
++
++Isometric Feature Mapping (isomap)
++
++Call:
++isomap(dist = dis, k = 3) 
++
++Distance method: bray shortest isomap 
++Criterion: k = 3 
++> pl <- plot(ord, main="isomap k=3")
++> lines(tr, pl, col="red")
++> pl <- plot(isomap(dis, k=5), main="isomap k=5")
++> lines(tr, pl, col="red")
++> pl <- plot(isomap(dis, epsilon=0.45), main="isomap epsilon=0.45")
++> lines(tr, pl, col="red")
++> par(op)
++> ## colour points and web by the dominant species
++> dom <- apply(BCI, 1, which.max)
++> ## need nine colours, but default palette  has only eight
++> op <- palette(c(palette("default"), "sienna"))
++> plot(ord, pch = 16, col = dom, n.col = dom) 
++> palette(op)
++> 
++> 
++> 
++> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
++> cleanEx()
++> nameEx("kendall.global")
++> ### * kendall.global
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: kendall.global
++> ### Title: Kendall coefficient of concordance
++> ### Aliases: kendall.global kendall.post
++> ### Keywords: multivariate nonparametric
++> 
++> ### ** Examples
++> 
++> data(mite)
++> mite.hel <- decostand(mite, "hel")
++> 
++> # Reproduce the results shown in Table 2 of Legendre (2005), a single group
++> mite.small <- mite.hel[c(4,9,14,22,31,34,45,53,61,69),c(13:15,23)]
++> kendall.global(mite.small, nperm=49)
++$Concordance_analysis
++              Group.1
++W          0.44160305
++F          2.37252221
++Prob.F     0.04403791
++Chi2      15.89770992
++Prob.perm  0.04000000
++
++attr(,"class")
++[1] "kendall.global"
++> kendall.post(mite.small, mult="holm", nperm=49)
++$A_posteriori_tests
++                    TVEL      ONOV      SUCT   Trhypch1
++Spearman.mean  0.3265678 0.3965503 0.4570402 -0.1681251
++W.per.species  0.4949258 0.5474127 0.5927802  0.1239061
++Prob           0.1400000 0.0200000 0.0200000  0.7200000
++Corrected prob 0.2800000 0.0800000 0.0800000  0.7200000
++
++$Correction.type
++[1] "holm"
++
++attr(,"class")
++[1] "kendall.post"
++> 
++> # Reproduce the results shown in Tables 3 and 4 of Legendre (2005), 2 groups
++> group <-c(1,1,2,1,1,1,1,1,2,1,1,1,1,1,1,2,1,2,1,1,1,1,2,1,2,1,1,1,1,1,2,2,2,2,2)
++> kendall.global(mite.hel, group=group, nperm=49)
++$Concordance_analysis
++                         Group.1      Group.2
++W                   3.097870e-01 2.911888e-01
++F                   1.032305e+01 4.108130e+00
++Prob.F              1.177138e-85 4.676566e-22
++Corrected prob.F    2.354275e-85 4.676566e-22
++Chi2                5.130073e+02 2.210123e+02
++Prob.perm           2.000000e-02 2.000000e-02
++Corrected prob.perm 4.000000e-02 4.000000e-02
++
++$Correction.type
++[1] "holm"
++
++attr(,"class")
++[1] "kendall.global"
++> kendall.post(mite.hel, group=group, mult="holm", nperm=49)
++$A_posteriori_tests_Group
++$A_posteriori_tests_Group[[1]]
++                  Brachy      PHTH     RARD      SSTR   Protopl      MEGR
++Spearman.mean  0.1851177 0.4258111 0.359058 0.2505486 0.1802160 0.2833298
++W.per.species  0.2190711 0.4497357 0.385764 0.2817757 0.2143736 0.3131911
++Prob           0.0200000 0.0200000 0.020000 0.0200000 0.0200000 0.0200000
++Corrected prob 0.7000000 0.7000000 0.700000 0.7000000 0.7000000 0.7000000
++                     MPRO      HMIN     HMIN2      NPRA      TVEL      ONOV
++Spearman.mean  0.09248024 0.2444656 0.4138494 0.1263751 0.4177343 0.3301159
++W.per.species  0.13029357 0.2759462 0.4382723 0.1627761 0.4419954 0.3580278
++Prob           0.22000000 0.0200000 0.0200000 0.0400000 0.0200000 0.0200000
++Corrected prob 0.70000000 0.7000000 0.7000000 0.7000000 0.7000000 0.7000000
++                    SUCT Oribatl1      PWIL  Galumna1  Stgncrs2      HRUF
++Spearman.mean  0.2185421 0.421216 0.2574779 0.4180699 0.3623428 0.1250230
++W.per.species  0.2511028 0.445332 0.2884163 0.4423170 0.3889118 0.1614804
++Prob           0.0200000 0.020000 0.0200000 0.0200000 0.0200000 0.0400000
++Corrected prob 0.7000000 0.700000 0.7000000 0.7000000 0.7000000 0.7000000
++                    PPEL      SLAT      FSET  Lepidzts  Eupelops  Miniglmn
++Spearman.mean  0.2188216 0.3016159 0.4217606 0.2577037 0.1108022 0.2301430
++W.per.species  0.2513707 0.3307153 0.4458539 0.2886327 0.1478521 0.2622203
++Prob           0.0200000 0.0200000 0.0200000 0.0200000 0.0600000 0.0200000
++Corrected prob 0.7000000 0.7000000 0.7000000 0.7000000 0.7000000 0.7000000
++
++$A_posteriori_tests_Group[[2]]
++                    HPAV      TVIE      LCIL  Ceratoz1  Trhypch1      NCOR
++Spearman.mean  0.1222579 0.2712078 0.1906408 0.1375601 0.1342409 0.3342345
++W.per.species  0.2020527 0.3374616 0.2642189 0.2159637 0.2129463 0.3947586
++Prob           0.0800000 0.0200000 0.0200000 0.0200000 0.0400000 0.0200000
++Corrected prob 0.7000000 0.7000000 0.7000000 0.7000000 0.7000000 0.7000000
++                    LRUG     PLAG2  Ceratoz3  Oppiminu  Trimalc2
++Spearman.mean  0.3446561 0.1833099 0.3188922 0.1764232 0.2498877
++W.per.species  0.4042328 0.2575544 0.3808111 0.2512938 0.3180797
++Prob           0.0200000 0.0200000 0.0200000 0.0200000 0.0200000
++Corrected prob 0.7000000 0.7000000 0.7000000 0.7000000 0.7000000
++
++
++$Correction.type
++[1] "holm"
++
++attr(,"class")
++[1] "kendall.post"
++> 
++> # NOTE: 'nperm' argument usually needs to be larger than 49.
++> # It was set to this low value for demonstration purposes.
++> 
++> 
++> 
++> cleanEx()
++> nameEx("linestack")
++> ### * linestack
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: linestack
++> ### Title: Plots One-dimensional Diagrams without Overwriting Labels
++> ### Aliases: linestack
++> ### Keywords: hplot aplot
++> 
++> ### ** Examples
++> 
++> ## First DCA axis
++> data(dune)
++> ord <- decorana(dune)
++> linestack(scores(ord, choices=1, display="sp"))
++> linestack(scores(ord, choices=1, display="si"), side="left", add=TRUE)
++> title(main="DCA axis 1")
++> 
++> ## Expressions as labels
++> N <- 10					# Number of sites
++> df <- data.frame(Ca = rlnorm(N, 2), NO3 = rlnorm(N, 4),
+++                  SO4 = rlnorm(N, 10), K = rlnorm(N, 3))
++> ord <- rda(df, scale = TRUE)
++> ### vector of expressions for labels
++> labs <- expression(Ca^{2+phantom()},
+++                    NO[3]^{-phantom()},
+++                    SO[4]^{-2},
+++                    K^{+phantom()})
++> scl <- "sites"
++> linestack(scores(ord, choices = 1, display = "species", scaling = scl),
+++           labels = labs, air = 2)
++> linestack(scores(ord, choices = 1, display = "site", scaling = scl),
+++           side = "left", add = TRUE)
++> title(main = "PCA axis 1")
++> 
++> 
++> 
++> cleanEx()
++> nameEx("make.cepnames")
++> ### * make.cepnames
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: make.cepnames
++> ### Title: Abbreviates a Botanical or Zoological Latin Name into an
++> ###   Eight-character Name
++> ### Aliases: make.cepnames
++> ### Keywords: character
++> 
++> ### ** Examples
++> 
++> make.cepnames(c("Aa maderoi", "Poa sp.", "Cladina rangiferina",
+++ "Cladonia cornuta", "Cladonia cornuta var. groenlandica",
+++ "Cladonia rangiformis", "Bryoerythrophyllum"))
++[1] "Aamade"     "Poasp"      "Cladrang"   "Cladcorn"   "Cladgroe"  
++[6] "Cladrang.1" "Bryrythr"  
++> data(BCI)
++> colnames(BCI) <- make.cepnames(colnames(BCI))
++> 
++> 
++> 
++> cleanEx()
++> nameEx("mantel")
++> ### * mantel
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: mantel
++> ### Title: Mantel and Partial Mantel Tests for Dissimilarity Matrices
++> ### Aliases: mantel mantel.partial
++> ### Keywords: multivariate htest
++> 
++> ### ** Examples
++> 
++> ## Is vegetation related to environment?
++> data(varespec)
++> data(varechem)
++> veg.dist <- vegdist(varespec) # Bray-Curtis
++> env.dist <- vegdist(scale(varechem), "euclid")
++> mantel(veg.dist, env.dist)
++
++Mantel statistic based on Pearson's product-moment correlation 
++
++Call:
++mantel(xdis = veg.dist, ydis = env.dist) 
++
++Mantel statistic r: 0.3047 
++      Significance: 0.001 
++
++Upper quantiles of permutations (null model):
++  90%   95% 97.5%   99% 
++0.107 0.145 0.169 0.200 
++Permutation: free
++Number of permutations: 999
++
++> mantel(veg.dist, env.dist, method="spear")
++
++Mantel statistic based on Spearman's rank correlation rho 
++
++Call:
++mantel(xdis = veg.dist, ydis = env.dist, method = "spear") 
++
++Mantel statistic r: 0.2838 
++      Significance: 0.001 
++
++Upper quantiles of permutations (null model):
++  90%   95% 97.5%   99% 
++0.108 0.141 0.169 0.196 
++Permutation: free
++Number of permutations: 999
++
++> 
++> 
++> 
++> cleanEx()
++> nameEx("mantel.correlog")
++> ### * mantel.correlog
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: mantel.correlog
++> ### Title: Mantel Correlogram
++> ### Aliases: mantel.correlog plot.mantel.correlog
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++>    
++> # Mite data available in "vegan"
++> data(mite)        
++> data(mite.xy)  
++> mite.hel <- decostand(mite, "hellinger")
++> 
++> # Detrend the species data by regression on the site coordinates
++> mite.hel.resid <- resid(lm(as.matrix(mite.hel) ~ ., data=mite.xy))
++> 
++> # Compute the detrended species distance matrix
++> mite.hel.D <- dist(mite.hel.resid)
++> 
++> # Compute Mantel correlogram with cutoff, Pearson statistic
++> mite.correlog <- mantel.correlog(mite.hel.D, XY=mite.xy, nperm=49)
++> summary(mite.correlog)
++           Length Class  Mode     
++mantel.res 65     -none- numeric  
++n.class     1     -none- numeric  
++break.pts  14     -none- numeric  
++mult        1     -none- character
++n.tests     1     -none- numeric  
++call        4     -none- call     
++> mite.correlog   
++
++Mantel Correlogram Analysis
++
++Call:
++ 
++mantel.correlog(D.eco = mite.hel.D, XY = mite.xy, nperm = 49) 
++
++        class.index     n.dist Mantel.cor Pr(Mantel) Pr(corrected)  
++D.cl.1     0.514182 358.000000   0.135713       0.02          0.02 *
++D.cl.2     1.242546 650.000000   0.118174       0.02          0.04 *
++D.cl.3     1.970910 796.000000   0.037820       0.04          0.06 .
++D.cl.4     2.699274 696.000000  -0.098605       0.02          0.08 .
++D.cl.5     3.427638 500.000000  -0.112682       0.02          0.10 .
++D.cl.6     4.156002 468.000000  -0.107603       0.02          0.12  
++D.cl.7     4.884366 364.000000  -0.022264       0.16          0.16  
++D.cl.8     5.612730 326.000000         NA         NA            NA  
++D.cl.9     6.341094 260.000000         NA         NA            NA  
++D.cl.10    7.069458 184.000000         NA         NA            NA  
++D.cl.11    7.797822 130.000000         NA         NA            NA  
++D.cl.12    8.526186  66.000000         NA         NA            NA  
++D.cl.13    9.254550  32.000000         NA         NA            NA  
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> # or: print(mite.correlog)
++> # or: print.mantel.correlog(mite.correlog)
++> plot(mite.correlog)
++> 
++> # Compute Mantel correlogram without cutoff, Spearman statistic
++> mite.correlog2 <- mantel.correlog(mite.hel.D, XY=mite.xy, cutoff=FALSE, 
+++    r.type="spearman", nperm=49)
++> summary(mite.correlog2)
++           Length Class  Mode     
++mantel.res 65     -none- numeric  
++n.class     1     -none- numeric  
++break.pts  14     -none- numeric  
++mult        1     -none- character
++n.tests     1     -none- numeric  
++call        6     -none- call     
++> mite.correlog2
++
++Mantel Correlogram Analysis
++
++Call:
++ 
++mantel.correlog(D.eco = mite.hel.D, XY = mite.xy, cutoff = FALSE,      r.type = "spearman", nperm = 49) 
++
++        class.index     n.dist Mantel.cor Pr(Mantel) Pr(corrected)  
++D.cl.1     0.514182 358.000000   0.134229       0.02          0.02 *
++D.cl.2     1.242546 650.000000   0.121270       0.02          0.04 *
++D.cl.3     1.970910 796.000000   0.035413       0.04          0.06 .
++D.cl.4     2.699274 696.000000  -0.095899       0.02          0.08 .
++D.cl.5     3.427638 500.000000  -0.118692       0.02          0.10 .
++D.cl.6     4.156002 468.000000  -0.117148       0.02          0.12  
++D.cl.7     4.884366 364.000000  -0.031123       0.06          0.14  
++D.cl.8     5.612730 326.000000   0.026064       0.06          0.16  
++D.cl.9     6.341094 260.000000   0.050573       0.04          0.18  
++D.cl.10    7.069458 184.000000   0.057017       0.02          0.20  
++D.cl.11    7.797822 130.000000   0.036195       0.08          0.22  
++D.cl.12    8.526186  66.000000  -0.054242       0.04          0.24  
++D.cl.13    9.254550  32.000000  -0.066677       0.02          0.26  
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> plot(mite.correlog2)
++> 
++> # NOTE: 'nperm' argument usually needs to be larger than 49.
++> # It was set to this low value for demonstration purposes.
++> 
++> 
++> 
++> 
++> cleanEx()
++> nameEx("metaMDS")
++> ### * metaMDS
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: metaMDS
++> ### Title: Nonmetric Multidimensional Scaling with Stable Solution from
++> ###   Random Starts, Axis Scaling and Species Scores
++> ### Aliases: metaMDS metaMDSdist metaMDSiter metaMDSredist initMDS postMDS
++> ###   plot.metaMDS points.metaMDS text.metaMDS scores.metaMDS
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> ## The recommended way of running NMDS (Minchin 1987)
++> ##
++> data(dune)
++> # Global NMDS using monoMDS
++> sol <- metaMDS(dune)
++Run 0 stress 0.1192678 
++Run 1 stress 0.1886532 
++Run 2 stress 0.1192678 
++... New best solution
++... Procrustes: rmse 4.497004e-05  max resid 0.0001297349 
++... Similar to previous best
++Run 3 stress 0.1192678 
++... New best solution
++... Procrustes: rmse 1.801542e-05  max resid 5.078152e-05 
++... Similar to previous best
++Run 4 stress 0.1183186 
++... New best solution
++... Procrustes: rmse 0.02025988  max resid 0.06488321 
++Run 5 stress 0.1192685 
++Run 6 stress 0.1939202 
++Run 7 stress 0.1808919 
++Run 8 stress 0.1183186 
++... Procrustes: rmse 1.538285e-05  max resid 4.789705e-05 
++... Similar to previous best
++Run 9 stress 0.1192679 
++Run 10 stress 0.1183186 
++... New best solution
++... Procrustes: rmse 1.244871e-05  max resid 3.745684e-05 
++... Similar to previous best
++Run 11 stress 0.1192686 
++Run 12 stress 0.1192683 
++Run 13 stress 0.1886532 
++Run 14 stress 0.1183186 
++... Procrustes: rmse 2.260742e-06  max resid 5.293932e-06 
++... Similar to previous best
++Run 15 stress 0.1192678 
++Run 16 stress 0.1183186 
++... Procrustes: rmse 3.225938e-06  max resid 7.314283e-06 
++... Similar to previous best
++Run 17 stress 0.2075713 
++Run 18 stress 0.1192678 
++Run 19 stress 0.1192685 
++Run 20 stress 0.1183186 
++... Procrustes: rmse 2.295609e-05  max resid 6.384852e-05 
++... Similar to previous best
++*** Solution reached
++> sol
++
++Call:
++metaMDS(comm = dune) 
++
++global Multidimensional Scaling using monoMDS
++
++Data:     dune 
++Distance: bray 
++
++Dimensions: 2 
++Stress:     0.1183186 
++Stress type 1, weak ties
++Two convergent solutions found after 20 tries
++Scaling: centring, PC rotation, halfchange scaling 
++Species: expanded scores based on ‘dune’ 
++
++> plot(sol, type="t")
++> ## Start from previous best solution
++> sol <- metaMDS(dune, previous.best = sol)
++Starting from 2-dimensional configuration
++Run 0 stress 0.1183186 
++Run 1 stress 0.1183186 
++... Procrustes: rmse 1.39695e-05  max resid 4.609836e-05 
++... Similar to previous best
++Run 2 stress 0.181294 
++Run 3 stress 0.1183186 
++... Procrustes: rmse 1.222929e-05  max resid 3.671397e-05 
++... Similar to previous best
++Run 4 stress 0.1192678 
++Run 5 stress 0.1192679 
++Run 6 stress 0.1183186 
++... Procrustes: rmse 3.046112e-05  max resid 9.621436e-05 
++... Similar to previous best
++Run 7 stress 0.1183186 
++... New best solution
++... Procrustes: rmse 8.248765e-06  max resid 2.709666e-05 
++... Similar to previous best
++Run 8 stress 0.1192679 
++Run 9 stress 0.1183186 
++... Procrustes: rmse 4.987329e-05  max resid 0.0001617922 
++... Similar to previous best
++Run 10 stress 0.1183186 
++... Procrustes: rmse 6.258948e-05  max resid 0.0001841984 
++... Similar to previous best
++Run 11 stress 0.1183186 
++... Procrustes: rmse 2.298969e-05  max resid 7.777073e-05 
++... Similar to previous best
++Run 12 stress 0.1183186 
++... Procrustes: rmse 9.953516e-05  max resid 0.0002971112 
++... Similar to previous best
++Run 13 stress 0.1192679 
++Run 14 stress 0.1183186 
++... Procrustes: rmse 0.0001064944  max resid 0.0003485089 
++... Similar to previous best
++Run 15 stress 0.1192678 
++Run 16 stress 0.1183187 
++... Procrustes: rmse 6.269441e-05  max resid 0.0001989035 
++... Similar to previous best
++Run 17 stress 0.1192685 
++Run 18 stress 0.1192679 
++Run 19 stress 0.1192683 
++Run 20 stress 0.1809581 
++*** Solution reached
++> ## Local NMDS and stress 2 of monoMDS
++> sol2 <- metaMDS(dune, model = "local", stress=2)
++Run 0 stress 0.1928489 
++Run 1 stress 0.1928478 
++... New best solution
++... Procrustes: rmse 0.000227748  max resid 0.0006739712 
++... Similar to previous best
++Run 2 stress 0.1928479 
++... Procrustes: rmse 0.0005683554  max resid 0.001654113 
++... Similar to previous best
++Run 3 stress 0.1928529 
++... Procrustes: rmse 0.001497169  max resid 0.004237256 
++... Similar to previous best
++Run 4 stress 0.1928479 
++... Procrustes: rmse 0.0002205786  max resid 0.000527516 
++... Similar to previous best
++Run 5 stress 0.1928542 
++... Procrustes: rmse 0.001703784  max resid 0.00489439 
++... Similar to previous best
++Run 6 stress 0.192857 
++... Procrustes: rmse 0.002035406  max resid 0.005757312 
++... Similar to previous best
++Run 7 stress 0.1928513 
++... Procrustes: rmse 0.0003555387  max resid 0.0009295202 
++... Similar to previous best
++Run 8 stress 0.1928514 
++... Procrustes: rmse 0.00131401  max resid 0.003754444 
++... Similar to previous best
++Run 9 stress 0.1928527 
++... Procrustes: rmse 0.001508577  max resid 0.004304102 
++... Similar to previous best
++Run 10 stress 0.1928516 
++... Procrustes: rmse 0.001200753  max resid 0.003381483 
++... Similar to previous best
++Run 11 stress 0.1928477 
++... New best solution
++... Procrustes: rmse 0.0002147781  max resid 0.0005379322 
++... Similar to previous best
++Run 12 stress 0.1928476 
++... New best solution
++... Procrustes: rmse 8.797899e-05  max resid 0.0002368433 
++... Similar to previous best
++Run 13 stress 0.1928518 
++... Procrustes: rmse 0.001194318  max resid 0.003382898 
++... Similar to previous best
++Run 14 stress 0.1928479 
++... Procrustes: rmse 0.0001251706  max resid 0.0003371929 
++... Similar to previous best
++Run 15 stress 0.1928498 
++... Procrustes: rmse 0.000713671  max resid 0.002074812 
++... Similar to previous best
++Run 16 stress 0.1928581 
++... Procrustes: rmse 0.001956972  max resid 0.005484317 
++... Similar to previous best
++Run 17 stress 0.1928499 
++... Procrustes: rmse 0.0008529383  max resid 0.002406656 
++... Similar to previous best
++Run 18 stress 0.1928478 
++... Procrustes: rmse 0.0003445826  max resid 0.0009688855 
++... Similar to previous best
++Run 19 stress 0.1928493 
++... Procrustes: rmse 0.0005050439  max resid 0.001350483 
++... Similar to previous best
++Run 20 stress 0.1928475 
++... New best solution
++... Procrustes: rmse 4.656629e-05  max resid 0.0001065303 
++... Similar to previous best
++*** Solution reached
++> sol2
++
++Call:
++metaMDS(comm = dune, model = "local", stress = 2) 
++
++local Multidimensional Scaling using monoMDS
++
++Data:     dune 
++Distance: bray 
++
++Dimensions: 2 
++Stress:     0.1928475 
++Stress type 2, weak ties
++Two convergent solutions found after 20 tries
++Scaling: centring, PC rotation, halfchange scaling 
++Species: expanded scores based on ‘dune’ 
++
++> ## Use Arrhenius exponent 'z' as a binary dissimilarity measure
++> sol <- metaMDS(dune, distfun = betadiver, distance = "z")
++Run 0 stress 0.1067169 
++Run 1 stress 0.1073148 
++Run 2 stress 0.1073148 
++Run 3 stress 0.1067169 
++... New best solution
++... Procrustes: rmse 9.860777e-06  max resid 3.045935e-05 
++... Similar to previous best
++Run 4 stress 0.1067169 
++... Procrustes: rmse 2.720552e-05  max resid 7.599563e-05 
++... Similar to previous best
++Run 5 stress 0.1073148 
++Run 6 stress 0.1653581 
++Run 7 stress 0.1073148 
++Run 8 stress 0.1067169 
++... Procrustes: rmse 1.047284e-05  max resid 2.581037e-05 
++... Similar to previous best
++Run 9 stress 0.1073148 
++Run 10 stress 0.1073148 
++Run 11 stress 0.1067169 
++... Procrustes: rmse 4.569546e-05  max resid 9.658124e-05 
++... Similar to previous best
++Run 12 stress 0.107471 
++Run 13 stress 0.107471 
++Run 14 stress 0.1073148 
++Run 15 stress 0.107471 
++Run 16 stress 0.1073148 
++Run 17 stress 0.1069788 
++... Procrustes: rmse 0.006831076  max resid 0.0241299 
++Run 18 stress 0.1067169 
++... New best solution
++... Procrustes: rmse 4.325792e-06  max resid 1.459835e-05 
++... Similar to previous best
++Run 19 stress 0.1067169 
++... Procrustes: rmse 1.880583e-05  max resid 4.343547e-05 
++... Similar to previous best
++Run 20 stress 0.1067169 
++... New best solution
++... Procrustes: rmse 1.608418e-06  max resid 3.595822e-06 
++... Similar to previous best
++*** Solution reached
++> sol
++
++Call:
++metaMDS(comm = dune, distance = "z", distfun = betadiver) 
++
++global Multidimensional Scaling using monoMDS
++
++Data:     dune 
++Distance: beta.z 
++
++Dimensions: 2 
++Stress:     0.1067169 
++Stress type 1, weak ties
++Two convergent solutions found after 20 tries
++Scaling: centring, PC rotation, halfchange scaling 
++Species: expanded scores based on ‘dune’ 
++
++> 
++> 
++> 
++> cleanEx()
++> nameEx("mite")
++> ### * mite
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: mite
++> ### Title: Oribatid Mite Data with Explanatory Variables
++> ### Aliases: mite mite.env mite.pcnm mite.xy
++> ### Keywords: datasets
++> 
++> ### ** Examples
++> 
++> data(mite)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("model.matrix.cca")
++> ### * model.matrix.cca
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: model.matrix.cca
++> ### Title: Reconstruct Model Frame and Model Matrices of Constrained
++> ###   Ordination
++> ### Aliases: model.matrix.cca model.frame.cca
++> ### Keywords: models multivariate
++> 
++> ### ** Examples
++> 
++> data(dune)
++> data(dune.env)
++> mod <- cca(dune ~  poly(A1, 2) + Management + Use, dune.env)
++> model.frame(mod)
++   poly(A1, 2).1 poly(A1, 2).2 Management      Use
++1    -0.21581339    0.31584574         SF Haypastu
++2    -0.14212101    0.10689011         BF Haypastu
++3    -0.05790115   -0.08310263         SF Haypastu
++4    -0.06842864   -0.06220100         SF Haypastu
++5     0.15264849   -0.33028722         HF Hayfield
++6    -0.05790115   -0.08310263         HF Haypastu
++7    -0.21581339    0.31584574         HF  Pasture
++8    -0.06842864   -0.06220100         HF  Pasture
++9    -0.12106605    0.05451056         HF Hayfield
++10   -0.16317598    0.16252391         BF Hayfield
++11   -0.14212101    0.10689011         BF  Pasture
++12    0.10001108   -0.29899963         SF Haypastu
++13    0.12106605   -0.31395535         SF Haypastu
++14    0.46847296   -0.09089291         NM  Pasture
++15    0.70007758    0.55002015         NM Haypastu
++16    0.08948360   -0.29030142         SF  Pasture
++17   -0.08948360   -0.01795706         NM Hayfield
++18   -0.02631871   -0.14092613         NM Hayfield
++19   -0.12106605    0.05451056         NM Hayfield
++20   -0.14212101    0.10689011         NM Hayfield
++> model.matrix(mod)
++   poly(A1, 2)1 poly(A1, 2)2 ManagementHF ManagementNM ManagementSF
++1   -0.21581339   0.31584574            0            0            1
++2   -0.14212101   0.10689011            0            0            0
++3   -0.05790115  -0.08310263            0            0            1
++4   -0.06842864  -0.06220100            0            0            1
++5    0.15264849  -0.33028722            1            0            0
++6   -0.05790115  -0.08310263            1            0            0
++7   -0.21581339   0.31584574            1            0            0
++8   -0.06842864  -0.06220100            1            0            0
++9   -0.12106605   0.05451056            1            0            0
++10  -0.16317598   0.16252391            0            0            0
++11  -0.14212101   0.10689011            0            0            0
++12   0.10001108  -0.29899963            0            0            1
++13   0.12106605  -0.31395535            0            0            1
++14   0.46847296  -0.09089291            0            1            0
++15   0.70007758   0.55002015            0            1            0
++16   0.08948360  -0.29030142            0            0            1
++17  -0.08948360  -0.01795706            0            1            0
++18  -0.02631871  -0.14092613            0            1            0
++19  -0.12106605   0.05451056            0            1            0
++20  -0.14212101   0.10689011            0            1            0
++           Use.L      Use.Q
++1  -7.850462e-17 -0.8164966
++2  -7.850462e-17 -0.8164966
++3  -7.850462e-17 -0.8164966
++4  -7.850462e-17 -0.8164966
++5  -7.071068e-01  0.4082483
++6  -7.850462e-17 -0.8164966
++7   7.071068e-01  0.4082483
++8   7.071068e-01  0.4082483
++9  -7.071068e-01  0.4082483
++10 -7.071068e-01  0.4082483
++11  7.071068e-01  0.4082483
++12 -7.850462e-17 -0.8164966
++13 -7.850462e-17 -0.8164966
++14  7.071068e-01  0.4082483
++15 -7.850462e-17 -0.8164966
++16  7.071068e-01  0.4082483
++17 -7.071068e-01  0.4082483
++18 -7.071068e-01  0.4082483
++19 -7.071068e-01  0.4082483
++20 -7.071068e-01  0.4082483
++> 
++> 
++> 
++> cleanEx()
++> nameEx("monoMDS")
++> ### * monoMDS
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: monoMDS
++> ### Title: Global and Local Non-metric Multidimensional Scaling and Linear
++> ###   and Hybrid Scaling
++> ### Aliases: monoMDS scores.monoMDS plot.monoMDS
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(dune)
++> dis <- vegdist(dune)
++> m <- monoMDS(dis, model = "loc")
++> m
++
++Call:
++monoMDS(dist = dis, model = "loc") 
++
++Local non-metric Multidimensional Scaling
++
++20 points, dissimilarity ‘bray’, call ‘vegdist(x = dune)’
++
++Dimensions: 2 
++Stress:     0.1238005 
++Stress type 1, weak ties
++Scores scaled to unit root mean square, rotated to principal components
++Stopped after 73 iterations: Stress nearly unchanged (ratio > sratmax)
++> plot(m)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("mrpp")
++> ### * mrpp
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: mrpp
++> ### Title: Multi Response Permutation Procedure and Mean Dissimilarity
++> ###   Matrix
++> ### Aliases: mrpp meandist summary.meandist plot.meandist
++> ### Keywords: multivariate nonparametric htest
++> 
++> ### ** Examples
++> 
++> data(dune)
++> data(dune.env)
++> dune.mrpp <- with(dune.env, mrpp(dune, Management))
++> dune.mrpp
++
++Call:
++mrpp(dat = dune, grouping = Management) 
++
++Dissimilarity index: euclidean 
++Weights for groups:  n 
++
++Class means and counts:
++
++      BF    HF    NM    SF   
++delta 10.03 11.08 10.66 12.27
++n     3     5     6     6    
++
++Chance corrected within-group agreement A: 0.1246 
++Based on observed delta 11.15 and expected delta 12.74 
++
++Significance of delta: 0.002 
++Permutation: free
++Number of permutations: 999
++
++> 
++> # Save and change plotting parameters
++> def.par <- par(no.readonly = TRUE)
++> layout(matrix(1:2,nr=1))
++> 
++> plot(dune.ord <- metaMDS(dune), type="text", display="sites" )
++Run 0 stress 0.1192678 
++Run 1 stress 0.2059799 
++Run 2 stress 0.1192678 
++... New best solution
++... Procrustes: rmse 3.906075e-05  max resid 0.0001192009 
++... Similar to previous best
++Run 3 stress 0.1192679 
++... Procrustes: rmse 0.0001096816  max resid 0.0003383007 
++... Similar to previous best
++Run 4 stress 0.2375284 
++Run 5 stress 0.1183186 
++... New best solution
++... Procrustes: rmse 0.02027545  max resid 0.0650119 
++Run 6 stress 0.1192678 
++Run 7 stress 0.1192678 
++Run 8 stress 0.2069991 
++Run 9 stress 0.1183186 
++... Procrustes: rmse 0.0001003641  max resid 0.0002670036 
++... Similar to previous best
++Run 10 stress 0.1922258 
++Run 11 stress 0.1192682 
++Run 12 stress 0.1192683 
++Run 13 stress 0.1809577 
++Run 14 stress 0.1886532 
++Run 15 stress 0.1192679 
++Run 16 stress 0.1192679 
++Run 17 stress 0.1192679 
++Run 18 stress 0.1192678 
++Run 19 stress 0.1183186 
++... Procrustes: rmse 0.0001010439  max resid 0.00034752 
++... Similar to previous best
++Run 20 stress 0.1192687 
++*** Solution reached
++> with(dune.env, ordihull(dune.ord, Management))
++> 
++> with(dune.mrpp, {
+++   fig.dist <- hist(boot.deltas, xlim=range(c(delta,boot.deltas)), 
+++                  main="Test of Differences Among Groups")
+++   abline(v=delta); 
+++   text(delta, 2*mean(fig.dist$counts), adj = -0.5,
+++      expression(bold(delta)), cex=1.5 )  }
+++ )
++> par(def.par)
++> ## meandist
++> dune.md <- with(dune.env, meandist(vegdist(dune), Management))
++> dune.md
++          BF        HF        NM        SF
++BF 0.4159972 0.4736637 0.7296979 0.6247169
++HF 0.4736637 0.4418115 0.7217933 0.5673664
++NM 0.7296979 0.7217933 0.6882438 0.7723367
++SF 0.6247169 0.5673664 0.7723367 0.5813015
++attr(,"class")
++[1] "meandist" "matrix"  
++attr(,"n")
++grouping
++BF HF NM SF 
++ 3  5  6  6 
++> summary(dune.md)
++
++Mean distances:
++                 Average
++within groups  0.5746346
++between groups 0.6664172
++overall        0.6456454
++
++Summary statistics:
++                        Statistic
++MRPP A weights n        0.1423836
++MRPP A weights n-1      0.1339124
++MRPP A weights n(n-1)   0.1099842
++Classification strength 0.1127012
++> plot(dune.md)
++> plot(dune.md, kind="histogram")
++> 
++> 
++> 
++> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
++> cleanEx()
++> nameEx("mso")
++> ### * mso
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: mso
++> ### Title: Functions for performing and displaying a spatial partitioning
++> ###   of cca or rda results
++> ### Aliases: mso msoplot
++> ### Keywords: spatial multivariate
++> 
++> ### ** Examples
++> 
++> ## Reconstruct worked example of Wagner (submitted):
++> X <- matrix(c(1, 2, 3, 2, 1, 0), 3, 2)
++> Y <- c(3, -1, -2)
++> tmat <- c(1:3)
++> ## Canonical correspondence analysis (cca):
++> Example.cca <- cca(X, Y)
++> Example.cca <- mso(Example.cca, tmat)
++Set of permutations < 'minperm'. Generating entire set.
++> msoplot(Example.cca)
++> Example.cca$vario
++  H Dist n  All       Sum         CA       CCA se
++1 1    1 2 0.25 0.3456633 0.07461735 0.2710459  0
++2 2    2 1 1.00 0.8086735 0.01147959 0.7971939 NA
++> 
++> ## Correspondence analysis (ca):
++> Example.ca <- mso(cca(X), tmat)
++Set of permutations < 'minperm'. Generating entire set.
++> msoplot(Example.ca)
++> 
++> ## Unconstrained ordination with test for autocorrelation
++> ## using oribatid mite data set as in Wagner (2004)
++> data(mite)
++> data(mite.env)
++> data(mite.xy)
++> 
++> mite.cca <- cca(log(mite + 1))
++> mite.cca <- mso(mite.cca, mite.xy, grain =  1, permutations = 99)
++> msoplot(mite.cca)
++> mite.cca
++Call: mso(object.cca = mite.cca, object.xy = mite.xy, grain = 1,
++permutations = 99)
++
++              Inertia Rank
++Total           1.164     
++Unconstrained   1.164   34
++Inertia is mean squared contingency coefficient 
++
++Eigenvalues for unconstrained axes:
++   CA1    CA2    CA3    CA4    CA5    CA6    CA7    CA8 
++0.3662 0.1328 0.0723 0.0658 0.0559 0.0481 0.0418 0.0391 
++(Showed only 8 of all 34 unconstrained eigenvalues)
++
++mso variogram:
++
++    H   Dist   n    All     CA CA.signif
++0   0 0.3555  63 0.6250 0.6250      0.01
++1   1 1.0659 393 0.7556 0.7556      0.01
++2   2 2.0089 534 0.8931 0.8931      0.01
++3   3 2.9786 417 1.0988 1.0988      0.03
++4   4 3.9817 322 1.3321 1.3321      0.01
++5   5 5.0204 245 1.5109 1.5109      0.01
++10 10 6.8069 441 1.7466 1.7466      0.01
++
++Permutation: free
++Number of permutations: 99
++
++> 
++> ## Constrained ordination with test for residual autocorrelation
++> ## and scale-invariance of species-environment relationships
++> mite.cca <- cca(log(mite + 1) ~ SubsDens + WatrCont + Substrate + Shrub + Topo, mite.env)
++> mite.cca <- mso(mite.cca, mite.xy, permutations = 99)
++> msoplot(mite.cca)
++Error variance of regression model underestimated by 0.4 percent 
++> mite.cca
++Call: mso(object.cca = mite.cca, object.xy = mite.xy, permutations =
++99)
++
++              Inertia Proportion Rank
++Total          1.1638     1.0000     
++Constrained    0.5211     0.4478   11
++Unconstrained  0.6427     0.5522   34
++Inertia is mean squared contingency coefficient 
++
++Eigenvalues for constrained axes:
++   CCA1    CCA2    CCA3    CCA4    CCA5    CCA6    CCA7    CCA8    CCA9   CCA10 
++0.31207 0.06601 0.04117 0.02938 0.02438 0.01591 0.01201 0.00752 0.00612 0.00373 
++  CCA11 
++0.00284 
++
++Eigenvalues for unconstrained axes:
++    CA1     CA2     CA3     CA4     CA5     CA6     CA7     CA8 
++0.07888 0.06752 0.05457 0.04023 0.03855 0.03491 0.03233 0.02692 
++(Showed only 8 of all 34 unconstrained eigenvalues)
++
++mso variogram:
++
++    H   Dist   n    All    Sum     CA    CCA      se CA.signif
++0   0 0.3555  63 0.6250 0.7479 0.5512 0.1967 0.03506      0.01
++1   1 1.0659 393 0.7556 0.8820 0.6339 0.2482 0.01573      0.17
++2   2 2.0089 534 0.8931 0.9573 0.6473 0.3100 0.01487      0.71
++3   3 2.9786 417 1.0988 1.1010 0.6403 0.4607 0.01858      0.46
++4   4 3.9817 322 1.3321 1.2548 0.6521 0.6027 0.02439      0.99
++5   5 5.0204 245 1.5109 1.4564 0.6636 0.7928 0.02801      0.42
++10 10 6.8069 441 1.7466 1.6266 0.6914 0.9351 0.02052      0.21
++
++Permutation: free
++Number of permutations: 99
++
++> 
++> 
++> 
++> cleanEx()
++> nameEx("multipart")
++> ### * multipart
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: multipart
++> ### Title: Multiplicative Diversity Partitioning
++> ### Aliases: multipart multipart.default multipart.formula
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> ## NOTE: 'nsimul' argument usually needs to be >= 99
++> ## here much lower value is used for demonstration
++> 
++> data(mite)
++> data(mite.xy)
++> data(mite.env)
++> ## Function to get equal area partitions of the mite data
++> cutter <- function (x, cut = seq(0, 10, by = 2.5)) {
+++     out <- rep(1, length(x))
+++     for (i in 2:(length(cut) - 1))
+++         out[which(x > cut[i] & x <= cut[(i + 1)])] <- i
+++     return(out)}
++> ## The hierarchy of sample aggregation
++> levsm <- with(mite.xy, data.frame(
+++     l1=1:nrow(mite),
+++     l2=cutter(y, cut = seq(0, 10, by = 2.5)),
+++     l3=cutter(y, cut = seq(0, 10, by = 5)),
+++     l4=cutter(y, cut = seq(0, 10, by = 10))))
++> ## Multiplicative diversity partitioning
++> multipart(mite, levsm, index="renyi", scales=1, nsimul=19)
++multipart object
++
++Call: multipart(y = mite, x = levsm, index = "renyi", scales = 1,
++nsimul = 19)
++
++nullmodel method ‘r2dtable’ with 19 simulations
++options:  index renyi, scales 1, global FALSE
++alternative hypothesis: statistic is less or greater than simulated values
++
++        statistic      SES     mean     2.5%      50%   97.5% Pr(sim.)  
++alpha.1    8.0555  -50.069 12.19396 12.06155 12.19041 12.3400     0.05 *
++alpha.2   11.2353  -91.662 14.09161 14.05255 14.08685 14.1485     0.05 *
++alpha.3   12.0064 -391.053 14.13939 14.13048 14.13932 14.1485     0.05 *
++gamma     14.1603    0.000 14.16027 14.16027 14.16027 14.1603     1.00  
++beta.1     1.3568   27.320  1.15770  1.14474  1.15859  1.1683     0.05 *
++beta.2     1.0710   30.431  1.00339  0.99912  1.00340  1.0059     0.05 *
++beta.3     1.1794  460.550  1.00148  1.00083  1.00148  1.0021     0.05 *
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> multipart(mite ~ ., levsm, index="renyi", scales=1, nsimul=19)
++multipart object
++
++Call: multipart(formula = mite ~ ., data = levsm, index = "renyi",
++scales = 1, nsimul = 19)
++
++nullmodel method ‘r2dtable’ with 19 simulations
++options:  index renyi, scales 1, global FALSE
++alternative hypothesis: statistic is less or greater than simulated values
++
++        statistic      SES    mean    2.5%     50%   97.5% Pr(sim.)  
++alpha.1    8.0555  -66.643 12.2056 12.1143 12.2120 12.2910     0.05 *
++alpha.2   11.2353  -94.626 14.0818 14.0246 14.0917 14.1193     0.05 *
++alpha.3   12.0064 -355.962 14.1391 14.1283 14.1374 14.1485     0.05 *
++gamma     14.1603    0.000 14.1603 14.1603 14.1603 14.1603     1.00  
++beta.1     1.3568   35.028  1.1566  1.1478  1.1565  1.1660     0.05 *
++beta.2     1.0710   33.423  1.0041  1.0015  1.0035  1.0078     0.05 *
++beta.3     1.1794  419.166  1.0015  1.0008  1.0016  1.0023     0.05 *
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> multipart(mite ~ ., levsm, index="renyi", scales=1, nsimul=19, relative=TRUE)
++multipart object
++
++Call: multipart(formula = mite ~ ., data = levsm, index = "renyi",
++scales = 1, relative = TRUE, nsimul = 19)
++
++nullmodel method ‘r2dtable’ with 19 simulations
++options:  index renyi, scales 1, global FALSE
++alternative hypothesis: statistic is less or greater than simulated values
++
++        statistic      SES      mean      2.5%       50%   97.5% Pr(sim.)  
++alpha.1  8.055481  -53.544 12.204883 12.071168 12.198307 12.3689     0.05 *
++alpha.2 11.235261  -99.506 14.079276 14.032767 14.076147 14.1247     0.05 *
++alpha.3 12.006443 -343.946 14.135245 14.123604 14.136297 14.1438     0.05 *
++gamma   14.160271    0.000 14.160271 14.160271 14.160271 14.1603     1.00  
++beta.1   0.078594   19.568  0.068267  0.067236  0.068392  0.0691     0.05 *
++beta.2   0.535514   35.966  0.501994  0.500294  0.502062  0.5035     0.05 *
++beta.3   0.589695  404.814  0.500885  0.500583  0.500848  0.5013     0.05 *
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> multipart(mite ~ ., levsm, index="renyi", scales=1, nsimul=19, global=TRUE)
++multipart object
++
++Call: multipart(formula = mite ~ ., data = levsm, index = "renyi",
++scales = 1, global = TRUE, nsimul = 19)
++
++nullmodel method ‘r2dtable’ with 19 simulations
++options:  index renyi, scales 1, global TRUE
++alternative hypothesis: statistic is less or greater than simulated values
++
++        statistic      SES     mean     2.5%      50%   97.5% Pr(sim.)  
++alpha.1    8.0555  -69.630 12.19342 12.09434 12.18504 12.3160     0.05 *
++alpha.2   11.2353  -81.676 14.09224 14.05248 14.09208 14.1625     0.05 *
++alpha.3   12.0064 -321.419 14.13850 14.12429 14.13991 14.1456     0.05 *
++gamma     14.1603    0.000 14.16027 14.16027 14.16027 14.1603     1.00  
++beta.1     1.7578  105.552  1.16133  1.14975  1.16210  1.1708     0.05 *
++beta.2     1.2603  102.695  1.00483  0.99985  1.00484  1.0077     0.05 *
++beta.3     1.1794  378.335  1.00154  1.00104  1.00144  1.0025     0.05 *
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> 
++> 
++> 
++> cleanEx()
++> nameEx("nestedtemp")
++> ### * nestedtemp
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: nestedtemp
++> ### Title: Nestedness Indices for Communities of Islands or Patches
++> ### Aliases: nestedtemp nestedchecker nestedn0 nesteddisc nestednodf
++> ###   nestedbetasor nestedbetajac plot.nestedtemp plot.nestednodf
++> ### Keywords: univar
++> 
++> ### ** Examples
++> 
++> data(sipoo)
++> ## Matrix temperature
++> out <- nestedtemp(sipoo)
++> out
++nestedness temperature: 10.24036 
++with matrix fill 0.2233333 
++> plot(out)
++> plot(out, kind="incid")
++> ## Use oecosimu to assess the non-randomness of checker board units
++> nestedchecker(sipoo)
++Checkerboard Units    : 2767 
++C-score (species mean): 2.258776 
++> oecosimu(sipoo, nestedchecker, "quasiswap")
++oecosimu object
++
++Call: oecosimu(comm = sipoo, nestfun = nestedchecker, method =
++"quasiswap")
++
++nullmodel method ‘quasiswap’ with 99 simulations
++
++alternative hypothesis: statistic is less or greater than simulated values
++
++Checkerboard Units    : 2767 
++C-score (species mean): 2.258776 
++
++              statistic     SES   mean   2.5%    50%  97.5% Pr(sim.)
++checkerboards      2767 0.84129 2698.1 2584.4 2676.0 2858.1     0.39
++> ## Another Null model and standardized checkerboard score
++> oecosimu(sipoo, nestedchecker, "r00", statistic = "C.score")
++oecosimu object
++
++Call: oecosimu(comm = sipoo, nestfun = nestedchecker, method = "r00",
++statistic = "C.score")
++
++nullmodel method ‘r00’ with 99 simulations
++
++alternative hypothesis: statistic is less or greater than simulated values
++
++Checkerboard Units    : 2767 
++C-score (species mean): 2.258776 
++
++        statistic    SES   mean   2.5%    50%  97.5% Pr(sim.)   
++C.score    2.2588 -28.92 9.2234 8.6935 9.2384 9.6053     0.01 **
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> 
++> 
++> 
++> cleanEx()
++> nameEx("nullmodel")
++> ### * nullmodel
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: nullmodel
++> ### Title: Null Model and Simulation
++> ### Aliases: nullmodel simmat print.nullmodel simulate.nullmodel
++> ###   update.nullmodel str.nullmodel print.simmat smbind
++> ### Keywords: multivariate datagen
++> 
++> ### ** Examples
++> 
++> data(mite)
++> x <- as.matrix(mite)[1:12, 21:30]
++> 
++> ## non-sequential nullmodel
++> (nm <- nullmodel(x, "r00"))
++An object of class “nullmodel” 
++‘r00’ method (binary, non-sequential)
++12 x 10 matrix
++
++> (sm <- simulate(nm, nsim=10))
++An object of class “simmat” 
++‘r00’ method (binary, non-sequential)
++12 x 10 matrix
++Number of permuted matrices = 10 
++
++> 
++> ## sequential nullmodel
++> (nm <- nullmodel(x, "swap"))
++An object of class “nullmodel” 
++‘swap’ method (binary, sequential)
++12 x 10 matrix
++Iterations = 0 
++
++> (sm1 <- simulate(nm, nsim=10, thin=5))
++An object of class “simmat” 
++‘swap’ method (binary, sequential)
++12 x 10 matrix
++Number of permuted matrices = 10 
++Start = 5, End = 50, Thin = 5
++
++> (sm2 <- simulate(nm, nsim=10, thin=5))
++An object of class “simmat” 
++‘swap’ method (binary, sequential)
++12 x 10 matrix
++Number of permuted matrices = 10 
++Start = 55, End = 100, Thin = 5
++
++> 
++> ## sequential nullmodel with burnin and extra updating
++> (nm <- nullmodel(x, "swap"))
++An object of class “nullmodel” 
++‘swap’ method (binary, sequential)
++12 x 10 matrix
++Iterations = 0 
++
++> (sm1 <- simulate(nm, burnin=10, nsim=10, thin=5))
++An object of class “simmat” 
++‘swap’ method (binary, sequential)
++12 x 10 matrix
++Number of permuted matrices = 10 
++Start = 15, End = 60, Thin = 5
++
++> (sm2 <- simulate(nm, nsim=10, thin=5))
++An object of class “simmat” 
++‘swap’ method (binary, sequential)
++12 x 10 matrix
++Number of permuted matrices = 10 
++Start = 5, End = 50, Thin = 5
++
++> 
++> ## sequential nullmodel with separate initial burnin
++> (nm <- nullmodel(x, "swap"))
++An object of class “nullmodel” 
++‘swap’ method (binary, sequential)
++12 x 10 matrix
++Iterations = 0 
++
++> nm <- update(nm, nsim=10)
++> (sm2 <- simulate(nm, nsim=10, thin=5))
++An object of class “simmat” 
++‘swap’ method (binary, sequential)
++12 x 10 matrix
++Number of permuted matrices = 10 
++Start = 15, End = 60, Thin = 5
++
++> 
++> ## combining multiple simmat objects
++> 
++> ## stratification
++> nm1 <- nullmodel(x[1:6,], "r00")
++> sm1 <- simulate(nm1, nsim=10)
++> nm2 <- nullmodel(x[7:12,], "r00")
++> sm2 <- simulate(nm2, nsim=10)
++> smbind(sm1, sm2, MARGIN=1)
++An object of class “simmat” 
++‘r00’ method (binary, non-sequential)
++12 x 10 matrix
++Number of permuted matrices = 10 
++
++> 
++> ## binding subsequent samples from sequential algorithms
++> ## start, end, thin retained
++> nm <- nullmodel(x, "swap")
++> nm <- update(nm, nsim=10)
++> sm1 <- simulate(nm, nsim=10, thin=5)
++> sm2 <- simulate(nm, nsim=20, thin=5)
++> sm3 <- simulate(nm, nsim=10, thin=5)
++> smbind(sm3, sm2, sm1, MARGIN=3)
++An object of class “simmat” 
++‘swap’ method (binary, sequential)
++12 x 10 matrix
++Number of permuted matrices = 40 
++Start = 15, End = 210, Thin = 5
++
++> 
++> ## 'replicate' based usage which is similar to the output
++> ## of 'parLapply' or 'mclapply' in the 'parallel' package
++> ## start, end, thin are set, also noting number of chains
++> smfun <- function(x, burnin, nsim, thin) {
+++     nm <- nullmodel(x, "swap")
+++     nm <- update(nm, nsim=burnin)
+++     simulate(nm, nsim=nsim, thin=thin)
+++ }
++> smlist <- replicate(3, smfun(x, burnin=50, nsim=10, thin=5), simplify=FALSE)
++> smbind(smlist, MARGIN=3) # Number of permuted matrices = 30
++An object of class “simmat” 
++‘swap’ method (binary, sequential)
++12 x 10 matrix
++Number of permuted matrices = 30 
++Start = 55, End = 100, Thin = 5 (3 chains)
++
++> 
++> ## Not run: 
++> ##D ## parallel null model calculations
++> ##D library(parallel)
++> ##D 
++> ##D if (.Platform$OS.type == "unix") {
++> ##D ## forking on Unix systems
++> ##D smlist <- mclapply(1:3, function(i) smfun(x, burnin=50, nsim=10, thin=5))
++> ##D smbind(smlist, MARGIN=3)
++> ##D }
++> ##D 
++> ##D ## socket type cluster, works on all platforms
++> ##D cl <- makeCluster(3)
++> ##D clusterEvalQ(cl, library(vegan))
++> ##D clusterExport(cl, c("smfun", "x"))
++> ##D smlist <- parLapply(cl, 1:3, function(i) smfun(x, burnin=50, nsim=10, thin=5))
++> ##D stopCluster(cl)
++> ##D smbind(smlist, MARGIN=3)
++> ## End(Not run)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("oecosimu")
++> ### * oecosimu
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: oecosimu
++> ### Title: Evaluate Statistics with Null Models of Biological Communities
++> ### Aliases: oecosimu as.ts.oecosimu as.mcmc.oecosimu
++> ### Keywords: multivariate datagen nonparametric
++> 
++> ### ** Examples
++> 
++> ## Use the first eigenvalue of correspondence analysis as an index
++> ## of structure: a model for making your own functions.
++> data(sipoo)
++> ## Traditional nestedness statistics (number of checkerboard units)
++> oecosimu(sipoo, nestedchecker, "r0")
++oecosimu object
++
++Call: oecosimu(comm = sipoo, nestfun = nestedchecker, method = "r0")
++
++nullmodel method ‘r0’ with 99 simulations
++
++alternative hypothesis: statistic is less or greater than simulated values
++
++Checkerboard Units    : 2767 
++C-score (species mean): 2.258776 
++
++              statistic     SES   mean   2.5%    50%  97.5% Pr(sim.)   
++checkerboards      2767 -17.768 8034.6 7529.9 8052.0 8518.5     0.01 **
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> ## sequential model, one-sided test, a vector statistic
++> out <- oecosimu(sipoo, decorana, "swap", burnin=100, thin=10, 
+++    statistic="evals", alt = "greater")
++> out
++oecosimu object
++
++Call: oecosimu(comm = sipoo, nestfun = decorana, method = "swap",
++burnin = 100, thin = 10, statistic = "evals", alternative = "greater")
++
++nullmodel method ‘swap’ with 99 simulations
++options:  thin 10, burnin 100
++alternative hypothesis: statistic is greater than simulated values
++
++
++Call:
++nestfun(veg = comm) 
++
++Detrended correspondence analysis with 26 segments.
++Rescaling of axes with 4 iterations.
++
++                  DCA1   DCA2   DCA3    DCA4
++Eigenvalues     0.3822 0.2612 0.1668 0.08723
++Decorana values 0.4154 0.2465 0.1391 0.04992
++Axis lengths    2.9197 2.5442 2.7546 1.78074
++
++
++     statistic     SES    mean     50%    95% Pr(sim.)  
++DCA1  0.382249  1.8658 0.32404 0.32373 0.3726     0.02 *
++DCA2  0.261208  1.5772 0.21939 0.21617 0.2637     0.09 .
++DCA3  0.166788  0.5209 0.15594 0.15572 0.1859     0.30  
++DCA4  0.087226 -1.9822 0.13015 0.12649 0.1649     0.99  
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> ## Inspect the swap sequence as a time series object
++> plot(as.ts(out))
++> lag.plot(as.ts(out))
++> acf(as.ts(out))
++> ## Density plot
++> densityplot(permustats(out), as.table = TRUE, layout = c(1,4))
++> ## Use quantitative null models to compare
++> ## mean Bray-Curtis dissimilarities
++> data(dune)
++> meandist <- function(x) mean(vegdist(x, "bray"))
++> mbc1 <- oecosimu(dune, meandist, "r2dtable")
++> mbc1
++oecosimu object
++
++Call: oecosimu(comm = dune, nestfun = meandist, method = "r2dtable")
++
++nullmodel method ‘r2dtable’ with 99 simulations
++
++alternative hypothesis: statistic is less or greater than simulated values
++
++          statistic    SES    mean    2.5%     50%  97.5% Pr(sim.)   
++statistic   0.64565 16.876 0.46651 0.44565 0.46652 0.4826     0.01 **
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> 
++> ## Define your own null model as a 'commsim' function: shuffle cells
++> ## in each row
++> foo <- function(x, n, nr, nc, ...) {
+++    out <- array(0, c(nr, nc, n))
+++    for (k in seq_len(n))
+++       out[,,k] <- apply(x, 2, function(z) sample(z, length(z)))
+++    out
+++ }
++> cf <- commsim("myshuffle", foo, isSeq = FALSE, binary = FALSE, 
+++    mode = "double")
++> oecosimu(dune, meandist, cf)
++oecosimu object
++
++Call: oecosimu(comm = dune, nestfun = meandist, method = cf)
++
++nullmodel method ‘myshuffle’ with 99 simulations
++
++alternative hypothesis: statistic is less or greater than simulated values
++
++          statistic    SES    mean    2.5%     50%  97.5% Pr(sim.)  
++statistic   0.64565 2.7402 0.63542 0.62941 0.63519 0.6433     0.03 *
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> 
++> 
++> 
++> cleanEx()
++> nameEx("ordiArrowTextXY")
++> ### * ordiArrowTextXY
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: ordiArrowTextXY
++> ### Title: Support Functions for Drawing Vectors
++> ### Aliases: ordiArrowMul ordiArrowTextXY
++> ### Keywords: utilities
++> 
++> ### ** Examples
++> 
++>     ## Scale arrows by hand to fill 80% of the plot
++>     ## Biplot arrows by hand
++>     data(varespec, varechem)
++>     ord <- cca(varespec ~ Al + P + K, varechem)
++>     plot(ord, display = c("species","sites"))
++> 
++>     ## biplot scores
++>     bip <- scores(ord, choices = 1:2, display = "bp")
++> 
++>     ## scaling factor for arrows to fill 80% of plot
++>     (mul <- ordiArrowMul(bip, fill = 0.8))
++[1] 2.074256
++>     bip.scl <- bip * mul                    # Scale the biplot scores
++>     labs <- rownames(bip)                   # Arrow labels
++> 
++>     ## calculate coordinate of labels for arrows
++>     (bip.lab <- ordiArrowTextXY(bip.scl, rescale = FALSE, labels = labs))
++         [,1]       [,2]
++Al  1.8804734 -0.3506655
++P  -0.9169247 -1.6419989
++K  -0.9932187 -0.3713153
++> 
++>     ## draw arrows and text labels
++>     arrows(0, 0, bip.scl[,1], bip.scl[,2], length = 0.1)
++>     text(bip.lab, labels = labs)
++> 
++>     ## Handling of ordination objects directly
++>     mul2 <- ordiArrowMul(ord, display = "bp", fill = 0.8)
++>     stopifnot(all.equal(mul, mul2))
++> 
++> 
++> 
++> cleanEx()
++> nameEx("ordiarrows")
++> ### * ordiarrows
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: ordiarrows
++> ### Title: Add Arrows and Line Segments to Ordination Diagrams
++> ### Aliases: ordiarrows ordisegments ordigrid
++> ### Keywords: aplot
++> 
++> ### ** Examples
++> 
++> example(pyrifos)
++
++pyrifs> data(pyrifos)
++
++pyrifs> ditch <- gl(12, 1, length=132)
++
++pyrifs> week <- gl(11, 12, labels=c(-4, -1, 0.1, 1, 2, 4, 8, 12, 15, 19, 24))
++
++pyrifs> dose <- factor(rep(c(0.1, 0, 0, 0.9, 0, 44, 6, 0.1, 44, 0.9, 0, 6), 11))
++> mod <- rda(pyrifos)
++> plot(mod, type = "n")
++> ## Annual succession by ditches, colour by dose
++> ordiarrows(mod, ditch, label = TRUE, col = as.numeric(dose))
++> legend("topright", levels(dose), lty=1, col=1:5, title="Dose")
++> ## Show only control and highest Pyrifos treatment
++> plot(mod, type = "n")
++> ordiarrows(mod, ditch, label = TRUE, 
+++    show.groups = c("2", "3", "5", "11"))
++> ordiarrows(mod, ditch, label = TRUE, show = c("6", "9"),
+++    col = 2)
++> legend("topright", c("Control", "Pyrifos 44"), lty = 1, col = c(1,2))
++> 
++> 
++> 
++> cleanEx()
++> nameEx("ordihull")
++> ### * ordihull
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: ordihull
++> ### Title: Display Groups or Factor Levels in Ordination Diagrams
++> ### Aliases: ordihull ordispider ordiellipse ordibar ordicluster
++> ###   weights.cca weights.rda weights.decorana summary.ordihull
++> ###   scores.ordihull summary.ordiellipse ordiareatest
++> ### Keywords: aplot
++> 
++> ### ** Examples
++> 
++> data(dune)
++> data(dune.env)
++> mod <- cca(dune ~ Management, dune.env)
++> attach(dune.env)
++> plot(mod, type="n", scaling = "symmetric")
++> ## Catch the invisible result of ordihull...
++> pl <- ordihull(mod, Management, scaling = "symmetric", label = TRUE)
++> ## ... and find centres and areas of the hulls
++> summary(pl)
++            BF         HF         NM         SF
++CCA1 0.2917476 0.36826105 -1.3505642  0.2762936
++CCA2 0.8632208 0.09419919  0.2681515 -0.8139398
++Area 0.1951715 0.59943363  1.7398193  1.0144372
++> ## use more colours and add ellipsoid hulls
++> plot(mod, type = "n")
++> pl <- ordihull(mod, Management, scaling = "symmetric", col = 1:4,
+++   draw="polygon", label =TRUE)
++> ordiellipse(mod, Management, scaling = "symmetric", kind = "ehull",
+++   col = 1:4, lwd=3)
++> ## ordispider to connect WA and LC scores
++> plot(mod, dis=c("wa","lc"), type="p")
++> ordispider(mod)
++> ## Other types of plots
++> plot(mod, type = "p", display="sites")
++> cl <- hclust(vegdist(dune))
++> ordicluster(mod, cl, prune=3, col = cutree(cl, 4))
++> ## confidence ellipse: location of the class centroids
++> plot(mod, type="n", display = "sites")
++> text(mod, display="sites", labels = as.character(Management),
+++   col=as.numeric(Management))
++> pl <- ordiellipse(mod, Management, kind="se", conf=0.95, lwd=2,
+++   draw = "polygon", col=1:4, border=1:4, alpha=63)
++> summary(pl)
++            BF        HF          NM         SF
++CCA1 0.4312652 0.5583211 -1.87848340  0.5601499
++CCA2 1.3273917 0.6373120 -0.05503211 -1.3859924
++Area 1.4559842 1.3806668  2.73667419  1.5559135
++> ## add confidence bars
++> ordibar(mod, Management, kind="se", conf=0.95, lwd=2, col=1:4, label=TRUE)
++> 
++> 
++> 
++> cleanEx()
++
++detaching ‘dune.env’
++
++> nameEx("ordilabel")
++> ### * ordilabel
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: ordilabel
++> ### Title: Add Text on Non-transparent Label to an Ordination Plot.
++> ### Aliases: ordilabel
++> ### Keywords: aplot
++> 
++> ### ** Examples
++> 
++> data(dune)
++> ord <- cca(dune)
++> plot(ord, type = "n")
++> ordilabel(ord, dis="sites", cex=1.2, font=3, fill="hotpink", col="blue")
++> ## You may prefer separate plots, but here species as well
++> ordilabel(ord, dis="sp", font=2, priority=colSums(dune))
++> 
++> 
++> 
++> cleanEx()
++> nameEx("ordiplot")
++> ### * ordiplot
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: ordiplot
++> ### Title: Alternative plot and identify Functions for Ordination
++> ### Aliases: ordiplot identify.ordiplot scores.ordiplot points.ordiplot
++> ###   text.ordiplot
++> ### Keywords: hplot iplot aplot
++> 
++> ### ** Examples
++> 
++> # Draw a plot for a non-vegan ordination (cmdscale).
++> data(dune)
++> dune.dis <- vegdist(wisconsin(dune))
++> dune.mds <- cmdscale(dune.dis, eig = TRUE)
++> dune.mds$species <- wascores(dune.mds$points, dune, expand = TRUE)
++> fig <- ordiplot(dune.mds, type = "none")
++> points(fig, "sites", pch=21, col="red", bg="yellow")
++> text(fig, "species", col="blue", cex=0.9)
++> # Default plot of the previous using identify to label selected points
++> ## Not run: 
++> ##D fig <- ordiplot(dune.mds)
++> ##D identify(fig, "spec")
++> ## End(Not run)
++> 
++> 
++> 
++> 
++> cleanEx()
++> nameEx("ordipointlabel")
++> ### * ordipointlabel
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: ordipointlabel
++> ### Title: Ordination Plots with Points and Optimized Locations for Text
++> ### Aliases: ordipointlabel plot.ordipointlabel
++> ### Keywords: hplot aplot
++> 
++> ### ** Examples
++> 
++> data(dune)
++> ord <- cca(dune)
++> plt <- ordipointlabel(ord)
++> 
++> ## set scaling - should be no warnings!
++> ordipointlabel(ord, scaling = "sites")
++> 
++> ## plot then add
++> plot(ord, scaling = "symmetric", type = "n")
++> ordipointlabel(ord, display = "species", scaling = "symm", add = TRUE)
++> ordipointlabel(ord, display = "sites", scaling = "symm", add = TRUE)
++> 
++> ## redraw plot without rerunning SANN optimisation
++> plot(plt)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("ordiresids")
++> ### * ordiresids
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: ordiresids
++> ### Title: Plots of Residuals and Fitted Values for Constrained Ordination
++> ### Aliases: ordiresids
++> ### Keywords: hplot
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> data(varechem)
++> mod <- cca(varespec ~ Al + P + K, varechem)
++> ordiresids(mod)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("ordistep")
++> ### * ordistep
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: ordistep
++> ### Title: Choose a Model by Permutation Tests in Constrained Ordination
++> ### Aliases: ordistep ordiR2step
++> ### Keywords: multivariate models
++> 
++> ### ** Examples
++> 
++> ## See add1.cca for another example
++> 
++> ### Dune data
++> data(dune)
++> data(dune.env)
++> mod0 <- rda(dune ~ 1, dune.env)  # Model with intercept only
++> mod1 <- rda(dune ~ ., dune.env)  # Model with all explanatory variables
++> 
++> ## With scope present, the default direction is "both"
++> ordistep(mod0, scope = formula(mod1), perm.max = 200)
++
++Start: dune ~ 1 
++
++             Df    AIC      F Pr(>F)   
+++ Management  3 87.082 2.8400  0.005 **
+++ Moisture    3 87.707 2.5883  0.005 **
+++ Manure      4 89.232 1.9539  0.015 * 
+++ A1          1 89.591 1.9217  0.040 * 
+++ Use         2 91.032 1.1741  0.340   
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++
++Step: dune ~ Management 
++
++             Df   AIC    F Pr(>F)   
++- Management  3 89.62 2.84  0.005 **
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++
++           Df    AIC      F Pr(>F)   
+++ Moisture  3 85.567 1.9764  0.010 **
+++ Manure    3 87.517 1.3902  0.115   
+++ A1        1 87.424 1.2965  0.200   
+++ Use       2 88.284 1.0510  0.340   
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++
++Step: dune ~ Management + Moisture 
++
++             Df    AIC      F Pr(>F)   
++- Moisture    3 87.082 1.9764  0.015 * 
++- Management  3 87.707 2.1769  0.005 **
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++
++         Df    AIC      F Pr(>F)
+++ Manure  3 85.762 1.1225  0.275
+++ A1      1 86.220 0.8359  0.585
+++ Use     2 86.842 0.8027  0.700
++
++Call: rda(formula = dune ~ Management + Moisture, data = dune.env)
++
++              Inertia Proportion Rank
++Total         84.1237     1.0000     
++Constrained   46.4249     0.5519    6
++Unconstrained 37.6988     0.4481   13
++Inertia is variance 
++
++Eigenvalues for constrained axes:
++  RDA1   RDA2   RDA3   RDA4   RDA5   RDA6 
++21.588 14.075  4.123  3.163  2.369  1.107 
++
++Eigenvalues for unconstrained axes:
++  PC1   PC2   PC3   PC4   PC5   PC6   PC7   PC8   PC9  PC10  PC11  PC12  PC13 
++8.241 7.138 5.355 4.409 3.143 2.770 1.878 1.741 0.952 0.909 0.627 0.311 0.227 
++
++> 
++> ## Example without scope. Default direction is "backward"
++> ordistep(mod1, perm.max = 200) 
++
++Start: dune ~ A1 + Moisture + Management + Use + Manure 
++
++             Df    AIC      F Pr(>F)
++- Use         2 86.056 0.8330  0.640
++- A1          1 85.933 0.7933  0.580
++- Manure      3 87.357 1.0737  0.400
++- Management  2 87.672 1.1976  0.305
++- Moisture    3 88.818 1.3320  0.175
++
++Step: dune ~ A1 + Moisture + Management + Manure 
++
++             Df    AIC      F Pr(>F)
++- A1          1 85.762 0.8015  0.615
++- Manure      3 86.220 1.0829  0.395
++- Management  2 86.688 1.1728  0.275
++- Moisture    3 87.779 1.4140  0.125
++
++Step: dune ~ Moisture + Management + Manure 
++
++             Df    AIC      F Pr(>F)  
++- Manure      3 85.567 1.1225  0.325  
++- Management  2 86.060 1.1986  0.235  
++- Moisture    3 87.517 1.5788  0.065 .
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++
++Step: dune ~ Moisture + Management 
++
++             Df    AIC      F Pr(>F)   
++- Moisture    3 87.082 1.9764  0.015 * 
++- Management  3 87.707 2.1769  0.010 **
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++
++Call: rda(formula = dune ~ Moisture + Management, data = dune.env)
++
++              Inertia Proportion Rank
++Total         84.1237     1.0000     
++Constrained   46.4249     0.5519    6
++Unconstrained 37.6988     0.4481   13
++Inertia is variance 
++
++Eigenvalues for constrained axes:
++  RDA1   RDA2   RDA3   RDA4   RDA5   RDA6 
++21.588 14.075  4.123  3.163  2.369  1.107 
++
++Eigenvalues for unconstrained axes:
++  PC1   PC2   PC3   PC4   PC5   PC6   PC7   PC8   PC9  PC10  PC11  PC12  PC13 
++8.241 7.138 5.355 4.409 3.143 2.770 1.878 1.741 0.952 0.909 0.627 0.311 0.227 
++
++> 
++> ## Example of ordistep, forward
++> ## Not run: 
++> ##D ordistep(mod0, scope = formula(mod1), direction="forward", perm.max = 200)
++> ## End(Not run)
++> ### Mite data
++> data(mite)
++> data(mite.env)
++> mite.hel = decostand(mite, "hel")
++> mod0 <- rda(mite.hel ~ 1, mite.env)  # Model with intercept only
++> mod1 <- rda(mite.hel ~ ., mite.env)  # Model with all explanatory variables
++> 
++> ## Example of ordiR2step with default direction = "both"
++> ## (This never goes "backward" but evaluates included terms.)
++> step.res <- ordiR2step(mod0, mod1, perm.max = 200)
++Step: R2.adj= 0 
++Call: mite.hel ~ 1 
++ 
++                R2.adjusted
++<All variables>  0.43670383
+++ WatrCont       0.26084533
+++ Shrub          0.20716190
+++ Topo           0.15205437
+++ Substrate      0.07718348
+++ SubsDens       0.02632468
++<none>           0.00000000
++
++           Df     AIC     F Pr(>F)   
+++ WatrCont  1 -84.336 25.35  0.002 **
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++
++Step: R2.adj= 0.2608453 
++Call: mite.hel ~ WatrCont 
++ 
++                R2.adjusted
++<All variables>   0.4367038
+++ Shrub           0.3177536
+++ Topo            0.3120057
+++ Substrate       0.3091579
+++ SubsDens        0.3066715
++<none>            0.2608453
++- WatrCont        0.0000000
++
++        Df     AIC     F Pr(>F)   
+++ Shrub  2 -88.034 3.836  0.002 **
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++
++Step: R2.adj= 0.3177536 
++Call: mite.hel ~ WatrCont + Shrub 
++ 
++                R2.adjusted
++<All variables>   0.4367038
+++ Substrate       0.3653551
+++ Topo            0.3525851
+++ SubsDens        0.3446967
++<none>            0.3177536
++- Shrub           0.2608453
++- WatrCont        0.2071619
++
++            Df     AIC      F Pr(>F)   
+++ Substrate  6 -87.768 1.8251  0.002 **
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++
++Step: R2.adj= 0.3653551 
++Call: mite.hel ~ WatrCont + Shrub + Substrate 
++ 
++                R2.adjusted
++<All variables>   0.4367038
+++ Topo            0.4004249
+++ SubsDens        0.3901844
++<none>            0.3653551
++- Substrate       0.3177536
++- Shrub           0.3091579
++- WatrCont        0.2616484
++
++       Df     AIC      F Pr(>F)   
+++ Topo  1 -90.924 4.5095  0.004 **
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++
++Step: R2.adj= 0.4004249 
++Call: mite.hel ~ WatrCont + Shrub + Substrate + Topo 
++ 
++                R2.adjusted
++<All variables>   0.4367038
+++ SubsDens        0.4367038
++<none>            0.4004249
++- Topo            0.3653551
++- Shrub           0.3591790
++- Substrate       0.3525851
++- WatrCont        0.3145444
++
++           Df     AIC      F Pr(>F)   
+++ SubsDens  1 -94.489 4.7999  0.002 **
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++
++Step: R2.adj= 0.4367038 
++Call: mite.hel ~ WatrCont + Shrub + Substrate + Topo + SubsDens 
++ 
++                R2.adjusted
++<All variables>   0.4367038
++<none>            0.4367038
++- Shrub           0.4079297
++- SubsDens        0.4004249
++- Substrate       0.3951235
++- Topo            0.3901844
++- WatrCont        0.3357858
++
++> step.res$anova  # Summary table
++                 R2.adj Df     AIC       F Pr(>F)   
+++ WatrCont      0.26085  1 -84.336 25.3499  0.002 **
+++ Shrub         0.31775  2 -88.034  3.8360  0.002 **
+++ Substrate     0.36536  6 -87.768  1.8251  0.002 **
+++ Topo          0.40042  1 -90.924  4.5095  0.004 **
+++ SubsDens      0.43670  1 -94.489  4.7999  0.002 **
++<All variables> 0.43670                             
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> 
++> ## Example of ordiR2step with direction = "forward"
++> ## Not run: 
++> ##D step.res <- ordiR2step(mod0, scope = formula(mod1), direction="forward") 
++> ##D step.res$anova  # Summary table
++> ## End(Not run)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("ordisurf")
++> ### * ordisurf
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: ordisurf
++> ### Title: Fit and Plot Smooth Surfaces of Variables on Ordination.
++> ### Aliases: ordisurf ordisurf.default ordisurf.formula calibrate.ordisurf
++> ###   plot.ordisurf
++> ### Keywords: multivariate aplot
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> data(varechem)
++> vare.dist <- vegdist(varespec)
++> vare.mds <- monoMDS(vare.dist)
++> ordisurf(vare.mds ~ Baresoil, varechem, bubble = 5)
++
++Family: gaussian 
++Link function: identity 
++
++Formula:
++y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
++
++Estimated degrees of freedom:
++5.63  total = 6.63 
++
++REML score: 92.96761     
++> 
++> ## as above but without the extra penalties on smooth terms,
++> ## and using GCV smoothness selection (old behaviour of `ordisurf()`):
++> ordisurf(vare.mds ~ Baresoil, varechem, col = "blue", add = TRUE,
+++                         select = FALSE, method = "GCV.Cp")
++
++Family: gaussian 
++Link function: identity 
++
++Formula:
++y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
++
++Estimated degrees of freedom:
++6.45  total = 7.45 
++
++GCV score: 144.0039     
++> 
++> ## Cover of Cladina arbuscula
++> fit <- ordisurf(vare.mds ~ Cladarbu, varespec, family=quasipoisson) 
++> ## Get fitted values
++> calibrate(fit)
++       18        15        24        27        23        19        22        16 
++21.254026  5.675259  3.679616  3.898510  9.643821  7.698310  7.729203  9.758046 
++       28        13        14        20        25         7         5         6 
++ 2.743212 29.700556 11.971747  8.310960  5.390564 24.905994 11.007652 25.330656 
++        3         4         2         9        12        10        11        21 
++ 6.520708  9.410616  4.519672  4.090948 11.557930  4.314850 11.693692 14.243453 
++> 
++> ## Variable selection via additional shrinkage penalties
++> ## This allows non-significant smooths to be selected out
++> ## of the model not just to a linear surface. There are 2
++> ## options available:
++> ##  - option 1: `select = TRUE` --- the *default*
++> ordisurf(vare.mds ~ Baresoil, varechem, method = "REML", select = TRUE)
++
++Family: gaussian 
++Link function: identity 
++
++Formula:
++y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
++
++Estimated degrees of freedom:
++5.63  total = 6.63 
++
++REML score: 92.96761     
++> ##  - option 2: use a basis with shrinkage
++> ordisurf(vare.mds ~ Baresoil, varechem, method = "REML", bs = "ts")
++
++Family: gaussian 
++Link function: identity 
++
++Formula:
++y ~ s(x1, x2, k = 10, bs = "ts", fx = FALSE)
++
++Estimated degrees of freedom:
++4.43  total = 5.43 
++
++REML score: 96.2345     
++> ## or bs = "cs" with `isotropic = FALSE`
++> 
++> ## Plot method
++> plot(fit, what = "contour")
++> 
++> ## Plotting the "gam" object
++> plot(fit, what = "gam") ## 'col' and 'cex' not passed on
++> ## or via plot.gam directly
++> library(mgcv)
++Loading required package: nlme
++This is mgcv 1.8-12. For overview type 'help("mgcv-package")'.
++> plot.gam(fit, cex = 2, pch = 1, col = "blue")
++> ## 'col' effects all objects drawn...
++> 
++> ### controlling the basis functions used
++> ## Use Duchon splines
++> ordisurf(vare.mds ~ Baresoil, varechem, bs = "ds")
++
++Family: gaussian 
++Link function: identity 
++
++Formula:
++y ~ s(x1, x2, k = 10, bs = "ds", fx = FALSE)
++
++Estimated degrees of freedom:
++5.63  total = 6.63 
++
++REML score: 93.17149     
++> 
++> ## A fixed degrees of freedom smooth, must use 'select = FALSE'
++> ordisurf(vare.mds ~ Baresoil, varechem, knots = 4,
+++                         fx = TRUE, select = FALSE)
++
++Family: gaussian 
++Link function: identity 
++
++Formula:
++y ~ s(x1, x2, k = 4, bs = "tp", fx = TRUE)
++
++Estimated degrees of freedom:
++3  total = 4 
++
++REML score: 81.86011     
++> 
++> ## An anisotropic smoother with cubic regression spline bases
++> ordisurf(vare.mds ~ Baresoil, varechem, isotropic = FALSE,
+++                         bs = "cr", knots = 4)
++
++Family: gaussian 
++Link function: identity 
++
++Formula:
++y ~ te(x1, x2, k = c(4, 4), bs = c("cr", "cr"), fx = c(FALSE, 
++    FALSE))
++
++Estimated degrees of freedom:
++2.99  total = 3.99 
++
++REML score: 90.86099     
++> 
++> ## An anisotropic smoother with cubic regression spline with
++> ## shrinkage bases & different degrees of freedom in each dimension
++> ordisurf(vare.mds ~ Baresoil, varechem, isotropic = FALSE,
+++                         bs = "cs", knots = c(3,4), fx = TRUE,
+++                         select = FALSE)
++
++Family: gaussian 
++Link function: identity 
++
++Formula:
++y ~ te(x1, x2, k = c(3, 4), bs = c("cs", "cs"), fx = c(TRUE, 
++    TRUE))
++
++Estimated degrees of freedom:
++11  total = 12 
++
++REML score: 39.58245     
++> 
++> 
++> 
++> cleanEx()
++
++detaching ‘package:mgcv’, ‘package:nlme’
++
++> nameEx("orditkplot")
++> ### * orditkplot
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: orditkplot
++> ### Title: Ordination Plot with Movable Labels
++> ### Aliases: orditkplot plot.orditkplot scores.orditkplot points.orditkplot
++> ###   text.orditkplot
++> ### Keywords: iplot dynamic
++> 
++> ### ** Examples
++> 
++> ## The example needs user interaction and is not executed directly.
++> ## It should work when pasted to the window.
++> ## Not run: 
++> ##D data(varespec)
++> ##D ord <- cca(varespec)
++> ##D ## Do something with the graph and end by clicking "Dismiss"
++> ##D orditkplot(ord, mar = c(4,4,1,1)+.1, font=3)
++> ##D ## Use ordipointlabel to produce a plot that has both species and site
++> ##D ## scores in different colors and plotting symbols
++> ##D pl <- ordipointlabel(ord)
++> ##D orditkplot(pl)
++> ## End(Not run)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("orditorp")
++> ### * orditorp
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: orditorp
++> ### Title: Add Text or Points to Ordination Plots
++> ### Aliases: orditorp
++> ### Keywords: aplot hplot
++> 
++> ### ** Examples
++> 
++> ## A cluttered ordination plot :
++> data(BCI)
++> mod <- cca(BCI)
++> plot(mod, dis="sp", type="t")
++> # Now with orditorp and abbreviated species names
++> cnam <- make.cepnames(names(BCI))
++> plot(mod, dis="sp", type="n")
++> stems <- colSums(BCI)
++> orditorp(mod, "sp", label = cnam, priority=stems, pch="+", pcol="grey")
++> 
++> ## show select in action
++> set.seed(1)
++> take <- sample(ncol(BCI), 50)
++> plot(mod, dis="sp", type="n")
++> stems <- colSums(BCI)
++> orditorp(mod, "sp", label = cnam, priority=stems, select = take,
+++          pch="+", pcol="grey")
++> ## Don't show: 
++> ## example(orditorp) should not set random seed in the user session
++> rm(.Random.seed)
++> ## End(Don't show)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("ordixyplot")
++> ### * ordixyplot
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: ordixyplot
++> ### Title: Trellis (Lattice) Plots for Ordination
++> ### Aliases: ordixyplot ordisplom ordicloud panel.ordi panel.ordiarrows
++> ###   panel.ordi3d prepanel.ordi3d ordilattice.getEnvfit
++> ### Keywords: hplot
++> 
++> ### ** Examples
++> 
++> data(dune)
++> data(dune.env)
++> ord <- cca(dune)
++> ## Pairs plots
++> ordisplom(ord)
++> ordisplom(ord, data=dune.env, choices=1:2)
++> ordisplom(ord, data=dune.env, form = ~ . | Management, groups=Manure)
++> ## Scatter plot
++> ordixyplot(ord, data=dune.env, form = CA1 ~ CA2 | Management,
+++   groups=Manure)
++> ## Choose a different scaling
++> ordixyplot(ord, scaling = "symmetric")
++> ## ... Slices of third axis
++> ordixyplot(ord, form = CA1 ~ CA2 | equal.count(CA3, 4), type = c("g","p"))
++> ## Display environemntal variables
++> ordixyplot(ord, envfit = envfit(ord ~ Management + A1, dune.env, choices=1:3))
++> ## 3D Scatter plots
++> ordicloud(ord, form = CA2 ~ CA3*CA1, groups = Manure, data = dune.env)
++> ordicloud(ord, form = CA2 ~ CA3*CA1 | Management, groups = Manure,
+++    data = dune.env, auto.key = TRUE, type = c("p","h"))
++> 
++> 
++> 
++> cleanEx()
++> nameEx("pcnm")
++> ### * pcnm
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: pcnm
++> ### Title: Principal Coordinates of Neighbourhood Matrix
++> ### Aliases: pcnm scores.pcnm
++> ### Keywords: spatial multivariate
++> 
++> ### ** Examples
++> 
++> ## Example from Borcard & Legendre (2002)
++> data(mite.xy)
++> pcnm1 <- pcnm(dist(mite.xy))
++> op <- par(mfrow=c(1,3))
++> ## Map of PCNMs in the sample plot
++> ordisurf(mite.xy, scores(pcnm1, choi=1), bubble = 4, main = "PCNM 1")
++
++Family: gaussian 
++Link function: identity 
++
++Formula:
++y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
++
++Estimated degrees of freedom:
++8.71  total = 9.71 
++
++REML score: -120.7705     
++> ordisurf(mite.xy, scores(pcnm1, choi=2), bubble = 4, main = "PCNM 2")
++
++Family: gaussian 
++Link function: identity 
++
++Formula:
++y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
++
++Estimated degrees of freedom:
++7.18  total = 8.18 
++
++REML score: -103.4662     
++> ordisurf(mite.xy, scores(pcnm1, choi=3), bubble = 4, main = "PCNM 3")
++
++Family: gaussian 
++Link function: identity 
++
++Formula:
++y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
++
++Estimated degrees of freedom:
++8.32  total = 9.32 
++
++REML score: -94.19053     
++> par(op)
++> ## Plot first PCNMs against each other
++> ordisplom(pcnm1, choices=1:4)
++> ## Weighted PCNM for CCA
++> data(mite)
++> rs <- rowSums(mite)/sum(mite)
++> pcnmw <- pcnm(dist(mite.xy), w = rs)
++> ord <- cca(mite ~ scores(pcnmw))
++> ## Multiscale ordination: residual variance should have no distance
++> ## trend
++> msoplot(mso(ord, mite.xy))
++> 
++> 
++> 
++> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
++> cleanEx()
++> nameEx("permatfull")
++> ### * permatfull
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: permat
++> ### Title: Matrix Permutation Algorithms for Presence-Absence and Count
++> ###   Data
++> ### Aliases: permatfull permatswap summary.permat print.summary.permat
++> ###   print.permat plot.permat lines.permat as.ts.permat as.mcmc.permat
++> ### Keywords: multivariate datagen
++> 
++> ### ** Examples
++> 
++> ## A simple artificial community data matrix.
++> m <- matrix(c(
+++     1,3,2,0,3,1,
+++     0,2,1,0,2,1,
+++     0,0,1,2,0,3,
+++     0,0,0,1,4,3
+++     ), 4, 6, byrow=TRUE)
++> ## Using the quasiswap algorithm to create a 
++> ## list of permuted matrices, where
++> ## row/columns sums and matrix fill are preserved:
++> x1 <- permatswap(m, "quasiswap")
++> summary(x1)
++Summary of object of class 'permat'
++
++Call: permatswap(m = m, method = "quasiswap")
++
++Matrix type: count 
++Permutation type: swap
++Method: quasiswap_count, burnin: 0, thin: 1
++Restricted: FALSE 
++Fixed margins: both
++
++Matrix dimensions: 4 rows, 6 columns
++Sum of original matrix: 30
++Fill of original matrix: 0.62
++Number of permuted matrices: 99 
++
++Matrix sums retained: 100 %
++Matrix fill retained: 100 %
++Row sums retained:    100 %
++Column sums retained: 100 %
++Row incidences retained:    2.02 %
++Column incidences retained: 6.06 %
++
++Bray-Curtis dissimilarities among original and permuted matrices:
++   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
++ 0.2000  0.3667  0.4333  0.4202  0.4667  0.6333 
++
++Chi-squared for original matrix: 18.55
++Chi-squared values among expected and permuted matrices:
++   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
++  15.63   19.38   21.19   21.53   23.44   29.08 
++> ## Unrestricted permutation retaining
++> ## row/columns sums but not matrix fill:
++> x2 <- permatfull(m)
++> summary(x2)
++Summary of object of class 'permat'
++
++Call: permatfull(m = m)
++
++Matrix type: count 
++Permutation type: full
++Method: r2dtable
++Restricted: FALSE 
++Fixed margins: both
++
++Matrix dimensions: 4 rows, 6 columns
++Sum of original matrix: 30
++Fill of original matrix: 0.62
++Number of permuted matrices: 99 
++
++Matrix sums retained: 100 %
++Matrix fill retained: 18.18 %
++Row sums retained:    100 %
++Column sums retained: 100 %
++Row incidences retained:    0 %
++Column incidences retained: 1.01 %
++
++Bray-Curtis dissimilarities among original and permuted matrices:
++   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
++ 0.1667  0.3333  0.4000  0.3754  0.4333  0.5667 
++
++Chi-squared for original matrix: 18.55
++Chi-squared values among expected and permuted matrices:
++   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
++  7.857  12.640  15.650  16.410  20.240  33.150 
++> ## Unrestricted permutation of presence-absence type
++> ## not retaining row/columns sums:
++> x3 <- permatfull(m, "none", mtype="prab")
++> x3$orig  ## note: original matrix is binarized!
++     [,1] [,2] [,3] [,4] [,5] [,6]
++[1,]    1    1    1    0    1    1
++[2,]    0    1    1    0    1    1
++[3,]    0    0    1    1    0    1
++[4,]    0    0    0    1    1    1
++> summary(x3)
++Summary of object of class 'permat'
++
++Call: permatfull(m = m, fixedmar = "none", mtype = "prab")
++
++Matrix type: prab 
++Permutation type: full
++Method: r00
++Restricted: FALSE 
++Fixed margins: none
++Individuals and samples are shuffled
++
++Matrix dimensions: 4 rows, 6 columns
++Sum of original matrix: 15
++Fill of original matrix: 0.62
++Number of permuted matrices: 99 
++
++Matrix sums retained: 100 %
++Matrix fill retained: 100 %
++Row sums retained:    2.02 %
++Column sums retained: 0 %
++Row incidences retained:    2.02 %
++Column incidences retained: 0 %
++
++Bray-Curtis dissimilarities among original and permuted matrices:
++   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
++ 0.2000  0.3333  0.4000  0.3643  0.4000  0.5333 
++
++Chi-squared for original matrix: 8.4
++Chi-squared values among expected and permuted matrices:
++   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
++  8.354  13.340  15.060  15.280  17.180  21.330 
++> ## Restricted permutation,
++> ## check sums within strata:
++> x4 <- permatfull(m, strata=c(1,1,2,2))
++> summary(x4)
++Summary of object of class 'permat'
++
++Call: permatfull(m = m, strata = c(1, 1, 2, 2))
++
++Matrix type: count 
++Permutation type: full
++Method: r2dtable
++Restricted: TRUE 
++Fixed margins: both
++
++Matrix dimensions: 4 rows, 6 columns
++Sum of original matrix: 30
++Fill of original matrix: 0.62
++Number of permuted matrices: 99 
++
++Matrix sums retained: 100 %
++Matrix fill retained: 49.49 %
++Row sums retained:    100 %
++Column sums retained: 100 %
++Row incidences retained:    7.07 %
++Column incidences retained: 3.03 %
++Sums within strata retained: 100 %
++
++Bray-Curtis dissimilarities among original and permuted matrices:
++   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
++0.06667 0.20000 0.20000 0.21950 0.26670 0.40000 
++
++Chi-squared for original matrix: 18.55
++Chi-squared values among expected and permuted matrices:
++   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
++  14.21   18.28   19.84   20.85   23.01   32.63 
++> 
++> ## NOTE: 'times' argument usually needs to be >= 99
++> ## here much lower value is used for demonstration
++> 
++> ## Not sequential algorithm
++> data(BCI)
++> a <- permatswap(BCI, "quasiswap", times=19)
++> ## Sequential algorithm
++> b <- permatswap(BCI, "abuswap", fixedmar="col",
+++     burnin=0, thin=100, times=19)
++> opar <- par(mfrow=c(2,2))
++> plot(a, main="Not sequential")
++> plot(b, main="Sequential")
++> plot(a, "chisq")
++> plot(b, "chisq")
++> par(opar)
++> ## Extract Bray-Curtis dissimilarities
++> ## as time series
++> bc <- as.ts(b)
++> ## Lag plot
++> lag.plot(bc)
++> ## First order autoregressive model
++> mar <- arima(bc, c(1,0,0))
++> mar
++
++Call:
++arima(x = bc, order = c(1, 0, 0))
++
++Coefficients:
++         ar1  intercept
++      0.9914     0.1847
++s.e.  0.0122     0.1343
++
++sigma^2 estimated as 0.0003348:  log likelihood = 47.03,  aic = -88.06
++> ## Ljung-Box test of residuals
++> Box.test(residuals(mar))
++
++	Box-Pierce test
++
++data:  residuals(mar)
++X-squared = 0.0010721, df = 1, p-value = 0.9739
++
++> ## Graphical diagnostics
++> tsdiag(mar)
++> 
++> 
++> 
++> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
++> cleanEx()
++> nameEx("permustats")
++> ### * permustats
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: permustats
++> ### Title: Extract, Analyse and Display Permutation Results
++> ### Aliases: permustats permustats.adonis permustats.anosim
++> ###   permustats.anova.cca permustats.CCorA permustats.envfit
++> ###   permustats.factorfit permustats.mantel permustats.mrpp permustats.mso
++> ###   permustats.oecosimu permustats.ordiareatest
++> ###   permustats.permutest.betadisper permustats.permutest.cca
++> ###   permustats.protest permustats.vectorfit summary.permustats
++> ###   c.permustats densityplot.permustats density.permustats
++> ###   qqnorm.permustats qqmath.permustats
++> ### Keywords: distribution smooth
++> 
++> ### ** Examples
++> 
++> data(dune, dune.env)
++> mod <- adonis2(dune ~ Management + A1, data = dune.env)
++> ## use permustats
++> perm <- permustats(mod)
++> summary(perm)
++
++           statistic    SES   mean lower median  upper Pr(perm)   
++Management    3.0730 4.5815 1.0462       0.9470 1.8475    0.006 **
++A1            2.7676 2.6322 1.0364       0.8851 2.3280    0.025 * 
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++
++(Interval (Upper - Lower) = 0.95)
++> densityplot(perm)
++> qqmath(perm)
++> 
++> ## example of multiple types of statistic
++> mod <- with(dune.env, betadisper(vegdist(dune), Management))
++> pmod <- permutest(mod, nperm = 99, pairwise = TRUE)
++> perm <- permustats(pmod)
++> summary(perm, interval = 0.90)
++
++            statistic     SES    mean   lower  median   upper Pr(perm)  
++Overall (F)    1.9506  0.6046  1.2061          0.8375  2.7743    0.184  
++BF-HF (t)     -0.5634 -0.4179 -0.0584 -2.0011 -0.0974  1.8273    0.615  
++BF-NM (t)     -2.2387 -1.8228 -0.0941 -2.1192 -0.0944  1.7339    0.085 .
++BF-SF (t)     -1.1675 -0.8886 -0.0928 -2.1442 -0.0866  1.8232    0.333  
++HF-NM (t)     -2.1017 -1.8899 -0.0158 -1.8740  0.0412  1.6319    0.067 .
++HF-SF (t)     -0.8789 -0.7166 -0.0321 -1.8973 -0.0076  1.8362    0.431  
++NM-SF (t)      0.9485  0.8309 -0.0036 -1.8411 -0.0531  1.9024    0.367  
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++
++(Interval (Upper - Lower) = 0.9)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("permutest.betadisper")
++> ### * permutest.betadisper
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: permutest.betadisper
++> ### Title: Permutation test of multivariate homogeneity of groups
++> ###   dispersions (variances)
++> ### Aliases: permutest.betadisper
++> ### Keywords: methods multivariate
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> 
++> ## Bray-Curtis distances between samples
++> dis <- vegdist(varespec)
++> 
++> ## First 16 sites grazed, remaining 8 sites ungrazed
++> groups <- factor(c(rep(1,16), rep(2,8)), labels = c("grazed","ungrazed"))
++> 
++> ## Calculate multivariate dispersions
++> mod <- betadisper(dis, groups)
++> mod
++
++	Homogeneity of multivariate dispersions
++
++Call: betadisper(d = dis, group = groups)
++
++No. of Positive Eigenvalues: 15
++No. of Negative Eigenvalues: 8
++
++Average distance to median:
++  grazed ungrazed 
++  0.3926   0.2706 
++
++Eigenvalues for PCoA axes:
++ PCoA1  PCoA2  PCoA3  PCoA4  PCoA5  PCoA6  PCoA7  PCoA8 
++1.7552 1.1334 0.4429 0.3698 0.2454 0.1961 0.1751 0.1284 
++> 
++> ## Perform test
++> anova(mod)
++Analysis of Variance Table
++
++Response: Distances
++          Df  Sum Sq  Mean Sq F value  Pr(>F)  
++Groups     1 0.07931 0.079306  4.6156 0.04295 *
++Residuals 22 0.37801 0.017182                  
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> 
++> ## Permutation test for F
++> pmod <- permutest(mod, permutations = 99, pairwise = TRUE)
++> 
++> ## Tukey's Honest Significant Differences
++> (mod.HSD <- TukeyHSD(mod))
++  Tukey multiple comparisons of means
++    95% family-wise confidence level
++
++Fit: aov(formula = distances ~ group, data = df)
++
++$group
++                      diff        lwr          upr     p adj
++ungrazed-grazed -0.1219422 -0.2396552 -0.004229243 0.0429502
++
++> plot(mod.HSD)
++> 
++> ## Has permustats() method
++> pstat <- permustats(pmod)
++> densityplot(pstat, scales = list(x = list(relation = "free")))
++> qqmath(pstat, scales = list(relation = "free"))
++> 
++> 
++> 
++> cleanEx()
++> nameEx("plot.cca")
++> ### * plot.cca
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: plot.cca
++> ### Title: Plot or Extract Results of Constrained Correspondence Analysis
++> ###   or Redundancy Analysis
++> ### Aliases: plot.cca text.cca points.cca scores.cca scores.rda summary.cca
++> ###   print.summary.cca ade2vegancca head.summary.cca tail.summary.cca
++> ### Keywords: hplot aplot
++> 
++> ### ** Examples
++> 
++> data(dune)
++> data(dune.env)
++> mod <- cca(dune ~ A1 + Moisture + Management, dune.env)
++> plot(mod, type="n")
++> text(mod, dis="cn")
++> points(mod, pch=21, col="red", bg="yellow", cex=1.2)
++> text(mod, "species", col="blue", cex=0.8)
++> ## Limited output of 'summary'
++> head(summary(mod), tail=2)
++
++Call:
++cca(formula = dune ~ A1 + Moisture + Management, data = dune.env) 
++
++Partitioning of mean squared contingency coefficient:
++              Inertia Proportion
++Total          2.1153     1.0000
++Constrained    1.1392     0.5385
++Unconstrained  0.9761     0.4615
++
++Eigenvalues, and their contribution to the mean squared contingency coefficient 
++
++Importance of components:
++                        CCA1   CCA2    CCA3    CCA4    CCA5    CCA6    CCA7
++Eigenvalue            0.4483 0.3001 0.14995 0.10733 0.05668 0.04335 0.03345
++Proportion Explained  0.2119 0.1419 0.07089 0.05074 0.02680 0.02050 0.01581
++Cumulative Proportion 0.2119 0.3538 0.42470 0.47544 0.50223 0.52273 0.53855
++                         CA1     CA2     CA3     CA4     CA5     CA6     CA7
++Eigenvalue            0.3064 0.13191 0.11516 0.10947 0.07724 0.07575 0.04871
++Proportion Explained  0.1448 0.06236 0.05444 0.05175 0.03652 0.03581 0.02303
++Cumulative Proportion 0.6834 0.74574 0.80018 0.85194 0.88845 0.92427 0.94730
++                          CA8     CA9    CA10    CA11     CA12
++Eigenvalue            0.03758 0.03106 0.02102 0.01254 0.009277
++Proportion Explained  0.01777 0.01468 0.00994 0.00593 0.004390
++Cumulative Proportion 0.96506 0.97975 0.98968 0.99561 1.000000
++
++Accumulated constrained eigenvalues
++Importance of components:
++                        CCA1   CCA2   CCA3    CCA4    CCA5    CCA6    CCA7
++Eigenvalue            0.4483 0.3001 0.1499 0.10733 0.05668 0.04335 0.03345
++Proportion Explained  0.3935 0.2635 0.1316 0.09422 0.04976 0.03806 0.02937
++Cumulative Proportion 0.3935 0.6570 0.7886 0.88282 0.93258 0.97063 1.00000
++
++Scaling 2 for species and site scores
++* Species are scaled proportional to eigenvalues
++* Sites are unscaled: weighted dispersion equal on all dimensions
++
++
++Species scores
++
++            CCA1    CCA2     CCA3     CCA4      CCA5     CCA6
++Achimill  0.8150  0.4375 -0.11236  0.35595 -0.114763 -0.01972
++Agrostol -0.7488 -0.4783  0.03561  0.17039  0.187389  0.23471
++Airaprae -0.8186  1.7469  1.04506 -0.28593  0.191836  0.73077
++Alopgeni -0.3442 -1.0216  0.37620  0.02296 -0.004041  0.04789
++Anthodor  0.3367  0.7694 -0.07602 -0.05421  0.136354  0.42463
++Bellpere  0.6535  0.2200  0.03438  0.60436 -0.090469  0.28138
++....                                                         
++Bracruta -0.1309  0.2009 -0.03708 -0.17421 -0.109657  0.04381
++Callcusp -1.5181  0.3834 -0.23255  0.15246  0.104239 -0.11424
++
++
++Site scores (weighted averages of species scores)
++
++        CCA1    CCA2     CCA3    CCA4    CCA5    CCA6
++1     1.2468 -0.4017  0.91955  0.7292  1.5785 -1.0196
++2     0.8622 -0.1641  0.25789  1.7240 -0.7592 -0.6479
++3     0.3165 -0.9785  0.82952  0.7451  0.6556  0.3256
++4     0.2405 -0.8699  1.07861  1.4103  1.1164  2.4714
++5     1.1362  0.2621 -1.10847 -0.9417  0.5630  1.1495
++6     1.0575  0.4041 -1.65035 -1.8483  1.0287 -0.1690
++....                                                 
++19   -0.7913  2.7451  2.93017 -1.3851 -0.3932  1.7277
++20   -2.0770  1.0113 -0.02581 -0.8949  1.6406 -1.7917
++
++
++Site constraints (linear combinations of constraining variables)
++
++        CCA1    CCA2     CCA3    CCA4    CCA5     CCA6
++1     0.7245 -0.3695  1.25652 -0.3678  0.9827 -0.60590
++2     0.9033  0.4250  0.03901  1.0557 -1.0860 -1.61234
++3     0.4493 -0.6694  0.67765  0.8695  0.9609  1.52307
++4     0.4550 -0.6532  0.72768  0.8529  0.9795  1.50218
++5     0.9671 -0.2010 -1.93972 -0.5807  0.2582  0.31905
++6     1.0805  0.1235 -0.93911 -0.9126  0.6307 -0.09863
++....                                                  
++19   -1.4581  1.6074  1.16812 -0.5305  0.3178 -0.40336
++20   -1.4468  1.6399  1.26818 -0.5637  0.3551 -0.44513
++
++
++Biplot scores for constraining variables
++
++                CCA1    CCA2     CCA3     CCA4     CCA5     CCA6
++A1           -0.5543 -0.1643 -0.68092  0.10702 -0.17968  0.30434
++Moisture.L   -0.9439 -0.1658  0.07947 -0.02251  0.03105 -0.02454
++Moisture.Q   -0.1865  0.3564 -0.45393 -0.17252  0.28388 -0.63130
++Moisture.C   -0.2065  0.1728  0.10624  0.68205  0.50145  0.35869
++ManagementHF  0.3621 -0.1143 -0.42227 -0.67858  0.17177 -0.12184
++ManagementNM -0.5835  0.7261 -0.01207 -0.09715 -0.11392  0.26924
++ManagementSF -0.1512 -0.6968  0.38542  0.24769  0.29474  0.23829
++
++
++Centroids for factor constraints
++
++                CCA1     CCA2     CCA3     CCA4     CCA5    CCA6
++Moisture1     0.9119  0.35388 -0.40013 -0.26218  0.02084 -0.4708
++Moisture2     0.5015 -0.06706  0.60222  1.12478  0.33942  1.2024
++Moisture4    -0.1522 -1.35873  0.76544 -1.37289 -1.80794  0.3849
++Moisture5    -1.3394  0.11972 -0.20942  0.04843  0.39751 -0.3902
++ManagementBF  0.8376  0.41614  0.13885  1.40679 -0.97766 -0.9604
++ManagementHF  0.5426 -0.17426 -0.62822 -1.00848  0.25622 -0.1834
++ManagementNM -1.1010  1.36665 -0.02097 -0.18131 -0.21523  0.5084
++ManagementSF -0.2320 -1.06831  0.59183  0.38035  0.45250  0.3659
++
++> ## Scaling can be numeric or more user-friendly names
++> ## e.g. Hill's scaling for (C)CA
++> scrs <- scores(mod, scaling = "sites", hill = TRUE)
++> ## or correlation-based scores in PCA/RDA
++> scrs <- scores(rda(dune ~ A1 + Moisture + Management, dune.env),
+++                scaling = "sites", correlation = TRUE)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("prc")
++> ### * prc
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: prc
++> ### Title: Principal Response Curves for Treatments with Repeated
++> ###   Observations
++> ### Aliases: prc summary.prc plot.prc
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> ## Chlorpyrifos experiment and experimental design: Pesticide
++> ## treatment in ditches (replicated) and followed over from 4 weeks
++> ## before to 24 weeks after exposure 
++> data(pyrifos)
++> week <- gl(11, 12, labels=c(-4, -1, 0.1, 1, 2, 4, 8, 12, 15, 19, 24))
++> dose <- factor(rep(c(0.1, 0, 0, 0.9, 0, 44, 6, 0.1, 44, 0.9, 0, 6), 11))
++> ditch <- gl(12, 1, length=132)
++> # PRC
++> mod <- prc(pyrifos, dose, week)
++> mod            # RDA
++Call: prc(response = pyrifos, treatment = dose, time = week)
++
++               Inertia Proportion Rank
++Total         288.9920     1.0000     
++Conditional    63.3493     0.2192   10
++Constrained    96.6837     0.3346   44
++Unconstrained 128.9589     0.4462   77
++Inertia is variance 
++
++Eigenvalues for constrained axes:
++  RDA1   RDA2   RDA3   RDA4   RDA5   RDA6   RDA7   RDA8   RDA9  RDA10  RDA11 
++25.282  8.297  6.044  4.766  4.148  3.857  3.587  3.334  3.087  2.551  2.466 
++ RDA12  RDA13  RDA14  RDA15  RDA16  RDA17  RDA18  RDA19  RDA20  RDA21  RDA22 
++ 2.209  2.129  1.941  1.799  1.622  1.579  1.440  1.398  1.284  1.211  1.133 
++ RDA23  RDA24  RDA25  RDA26  RDA27  RDA28  RDA29  RDA30  RDA31  RDA32  RDA33 
++ 1.001  0.923  0.862  0.788  0.750  0.712  0.685  0.611  0.584  0.537  0.516 
++ RDA34  RDA35  RDA36  RDA37  RDA38  RDA39  RDA40  RDA41  RDA42  RDA43  RDA44 
++ 0.442  0.417  0.404  0.368  0.340  0.339  0.306  0.279  0.271  0.205  0.179 
++
++Eigenvalues for unconstrained axes:
++   PC1    PC2    PC3    PC4    PC5    PC6    PC7    PC8 
++17.156  9.189  7.585  6.064  5.730  4.843  4.518  4.105 
++(Showed only 8 of all 77 unconstrained eigenvalues)
++
++> summary(mod)   # PRC
++
++Call:
++prc(response = pyrifos, treatment = dose, time = week) 
++Species scores:
++    Simve     Daplo     Cerpu     Alogu     Aloco     Alore     Aloaf     Copsp 
++-1.461934 -0.796510 -0.295171 -0.152301 -0.096273 -0.171335 -0.231967 -0.635966 
++    Ostsp     Slyla     Acrha     Aloex     Chysp     Alona     Plead     Oxyte 
++-1.257492  0.302872 -0.057396 -0.124049 -0.051689 -0.034638 -0.075268 -0.013815 
++    Grate     Copdi     NauLa     CilHa     Strvi     amosp     Ascmo     Synsp 
++-0.052667 -0.777088 -2.636100 -0.486881 -1.669474  0.738371 -0.037926  0.014409 
++    Squro     Squmu     Polar     Kerqu     Anufi     Mytve     Mytvi     Mytmu 
++-0.143790  0.246185 -0.251255 -0.269397 -0.235362 -0.040448 -0.049452 -0.057589 
++    Lepsp     Leppa     Colob     Colbi     Colun     Lecsp     Lecqu     Lecco 
++-0.542922 -0.046123  0.393234  0.075905  0.450495 -0.257170  0.048327  0.158007 
++    Leclu     Lecfl     Tripo     Cepsp     Monlo     Monae     Scalo     Trilo 
++-0.027077  0.221912 -0.117056  0.440303  0.287108  0.048918  0.041981  0.021257 
++  Tripo.1     Tricy     Trisp     Tepat     Rotne     Notla     Filsp     Lopox 
++-0.134025 -0.182409 -0.042651 -0.004198 -0.078168  0.062163  0.091561  0.016854 
++ hydrspec  bothrosp  olchaeta  erpoocto  glsicomp  alglhete  hebdstag   sphidae 
++ 0.026485 -0.216815  0.633674  0.490029  0.078527  0.039728 -0.490678 -0.796015 
++ ansuvote  armicris  bathcont  binitent  gyraalbu  hippcomp  lymnstag  lymnaes7 
++-0.076512 -0.913681 -0.039855  1.060788 -0.017975 -0.219974  0.143403 -0.073502 
++ physfont  plbacorn  popyanti  radiovat  radipere  valvcris  valvpisc  hycarina 
++ 0.014349 -0.046098 -0.691904  0.010777  0.340163 -0.005753  0.145523 -0.567803 
++ gammpule  aselaqua  proameri  collembo  caenhora  caenluct  caenrobu  cloedipt 
++-0.830166 -0.858606 -0.063401 -0.016264 -3.136867 -1.292300 -0.068624 -2.574625 
++ cloesimi  aeshniae  libellae  conagrae  corident  coripanz  coripunc  cymabons 
++-0.675580 -0.115677  0.044524 -0.886795 -0.007484 -0.065501  0.096124 -0.025213 
++ hesplinn  hespsahl  notoglau  notomacu  notoobli  notoviri  pacoconc  pleaminu 
++ 0.037779 -0.018078 -0.301948 -0.027226 -0.044790 -0.117398 -0.009087 -0.038705 
++ sigadist  sigafall  sigastri  sigarasp  colyfusc  donacis6  gyrimari  haliconf 
++-0.041594  0.009987 -0.032743  0.150817 -0.019847  0.042751 -0.005753 -0.243054 
++ haliflav  haligruf  haliobli  herubrev  hya_herm  hyglpusi  hyhyovat  hypoplan 
++-0.024222 -0.244814 -0.071501  0.069877  0.175327  0.006404 -0.013159 -0.008145 
++ hyporusp  hytuinae  hytuvers  laphminu  noteclav  rhantusp  sialluta  ablalong 
++-0.126197 -1.259664 -0.963901 -0.344204 -0.004303 -0.036774 -0.603320 -0.008145 
++ ablaphmo  cltanerv  malopisp  mopetenu  prdiussp  pstavari  chironsp  crchirsp 
++-1.627590 -0.041132 -0.025919 -0.004740 -0.301790 -0.045054 -1.027839 -0.009087 
++ crclglat  ditendsp  mitegchl  pachgarc  pachgvit  popegnub  popedisp  acriluce 
++-0.015746 -0.045402 -0.125429  0.006628  0.016265 -0.121971  0.037879  0.004324 
++ chclpige  conescut  cricotsp  liesspec  psclbarb  psclgsli  psclobvi  psclplat 
++ 0.004756 -0.446524 -0.066095 -0.058403  0.015576 -0.327165  0.197081  0.028310 
++ psclpsil  pscladsp  cladotsp  laa_spec  patanysp  tatarssp  zaa_spec  anopmacu 
++-0.003991 -0.003086 -0.293623 -0.018548 -0.079841 -0.364072 -0.027165  0.089046 
++ cepogoae  chaoobsc  cucidae4  tabanusp  agdasphr  athrater  cyrncren  holodubi 
++-1.389767 -1.328261 -0.018078  0.006309 -0.147828 -0.036774 -0.038705 -0.051532 
++ holopici  leceriae  lilurhom  monaangu  mystazur  mystloni  oecefurv  oecelacu 
++-0.332631 -0.162413 -0.004929 -0.350402 -0.018078 -1.630725 -0.291847 -0.140893 
++ triabico  paponysp 
++-0.048357 -0.053182 
++
++Coefficients for dose + week:dose interaction
++which are contrasts to dose 0 
++rows are dose, columns are week
++        -4     -1    0.1       1      2      4      8     12     15     19
++0.1 0.1327 0.2527 0.1875 0.07479 0.3863 0.2509 0.1485 0.2824 0.2064 0.3977
++0.9 0.1490 0.3558 0.3560 0.87706 0.9151 0.7918 0.2488 0.6523 0.4428 0.3229
++6   0.3055 0.2266 0.8346 2.12626 1.9923 2.1165 1.0317 0.8638 0.5660 0.6054
++44  0.2570 0.3601 1.3438 2.31842 2.3862 2.6894 2.3745 1.8536 1.4377 1.0607
++        24
++0.1 0.1441
++0.9 0.2839
++6   0.3352
++44  0.5704
++> logabu <- colSums(pyrifos)
++> plot(mod, select = logabu > 100)
++> ## Ditches are randomized, we have a time series, and are only
++> ## interested in the first axis
++> ctrl <- how(plots = Plots(strata = ditch,type = "free"),
+++     within = Within(type = "series"), nperm = 99)
++> anova(mod, permutations = ctrl, first=TRUE)
++Permutation test for rda under reduced model
++Plots: ditch, plot permutation: free
++Permutation: series
++Number of permutations: 99
++
++Model: prc(response = pyrifos, treatment = dose, time = week)
++         Df Variance      F Pr(>F)   
++RDA1      1   25.282 15.096   0.01 **
++Residual 77  128.959                 
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> 
++> 
++> 
++> cleanEx()
++> nameEx("predict.cca")
++> ### * predict.cca
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: predict.cca
++> ### Title: Prediction Tools for [Constrained] Ordination (CCA, RDA, DCA,
++> ###   CA, PCA)
++> ### Aliases: fitted.cca fitted.rda fitted.capscale fitted.dbrda
++> ###   residuals.cca predict.cca predict.rda predict.decorana coef.cca
++> ###   coef.rda calibrate.cca calibrate
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(dune)
++> data(dune.env)
++> mod <- cca(dune ~ A1 + Management + Condition(Moisture), data=dune.env)
++> # Definition of the concepts 'fitted' and 'residuals'
++> mod
++Call: cca(formula = dune ~ A1 + Management + Condition(Moisture), data
++= dune.env)
++
++              Inertia Proportion Rank
++Total          2.1153     1.0000     
++Conditional    0.6283     0.2970    3
++Constrained    0.5109     0.2415    4
++Unconstrained  0.9761     0.4615   12
++Inertia is mean squared contingency coefficient 
++
++Eigenvalues for constrained axes:
++   CCA1    CCA2    CCA3    CCA4 
++0.24932 0.12090 0.08160 0.05904 
++
++Eigenvalues for unconstrained axes:
++    CA1     CA2     CA3     CA4     CA5     CA6     CA7     CA8     CA9    CA10 
++0.30637 0.13191 0.11516 0.10947 0.07724 0.07575 0.04871 0.03758 0.03106 0.02102 
++   CA11    CA12 
++0.01254 0.00928 
++
++> cca(fitted(mod))
++Call: cca(X = fitted(mod))
++
++              Inertia Rank
++Total          0.5109     
++Unconstrained  0.5109    4
++Inertia is mean squared contingency coefficient 
++
++Eigenvalues for unconstrained axes:
++    CA1     CA2     CA3     CA4 
++0.24932 0.12090 0.08160 0.05904 
++
++> cca(residuals(mod))
++Call: cca(X = residuals(mod))
++
++              Inertia Rank
++Total          0.9761     
++Unconstrained  0.9761   12
++Inertia is mean squared contingency coefficient 
++
++Eigenvalues for unconstrained axes:
++    CA1     CA2     CA3     CA4     CA5     CA6     CA7     CA8     CA9    CA10 
++0.30637 0.13191 0.11516 0.10947 0.07724 0.07575 0.04871 0.03758 0.03106 0.02102 
++   CA11    CA12 
++0.01254 0.00928 
++
++> # Remove rare species (freq==1) from 'cca' and find their scores
++> # 'passively'.
++> freq <- specnumber(dune, MARGIN=2)
++> freq
++Achimill Agrostol Airaprae Alopgeni Anthodor Bellpere Bromhord Chenalbu 
++       7       10        2        8        6        6        5        1 
++Cirsarve Comapalu Eleopalu Elymrepe Empenigr Hyporadi Juncarti Juncbufo 
++       1        2        5        6        1        3        5        4 
++Lolipere Planlanc  Poaprat  Poatriv Ranuflam Rumeacet Sagiproc Salirepe 
++      12        7       14       13        6        5        7        3 
++Scorautu Trifprat Trifrepe Vicilath Bracruta Callcusp 
++      18        3       16        3       15        3 
++> mod <- cca(dune[, freq>1] ~ A1 + Management + Condition(Moisture), dune.env)
++> predict(mod, type="sp", newdata=dune[, freq==1], scaling="species")
++               CCA1       CCA2       CCA3       CCA4
++Chenalbu  1.5737337 -0.7842538  0.5503660 0.35108333
++Cirsarve  0.5945146 -0.3714228 -0.2862647 0.88373727
++Empenigr -1.8771953 -0.9904299 -0.2446222 0.04858656
++> # New sites
++> predict(mod, type="lc", new=data.frame(A1 = 3, Management="NM", Moisture="2"), scal=2)
++      CCA1      CCA2       CCA3       CCA4
++1 -2.38829 -1.230652 -0.2363485 -0.3338258
++> # Calibration and residual plot
++> mod <- cca(dune ~ A1 + Moisture, dune.env)
++> pred <- calibrate(mod)
++> pred
++           A1  Moisture.L  Moisture.Q   Moisture.C
++1   2.2630533 -0.62633470 -0.20456759  0.220761764
++2   4.0510042 -0.47341146 -0.36986691  0.474939409
++3   4.2752294 -0.07214500 -0.60797514  0.303213289
++4   4.5398659  0.03192745 -1.12417368  0.932223234
++5   5.0409406 -0.84235946  0.43000738 -0.291599200
++6   5.1962100 -0.91316862  1.11354235 -0.804453944
++7   4.2452549 -0.76452556  0.60464291 -0.484842066
++8   5.0208369  0.43886340  0.08169514  0.132995916
++9   4.2663219  0.10720486 -0.34067849 -0.675151598
++10  4.0411356 -0.65472729  0.02832164  0.558402684
++11  2.8280051 -0.45762457  0.63079135 -0.089977975
++12  5.1204137  0.36328912 -0.69118581 -0.665622948
++13  4.9034218  0.47069541 -0.54378271 -0.118643453
++14 11.6455841  0.60920550  0.78341426  0.532852308
++15 10.7829689  0.69208513  0.82190786  0.237311062
++16  7.9892176  0.96421599  0.46793089  0.373647014
++17  0.9218684 -0.15822891  0.14593271  1.189161582
++18  3.1680733 -0.41737900  1.03352732 -0.236938282
++19 -1.2003506  0.57033354  0.72777285  0.509955590
++20  4.7876770  1.00324330  1.49898460  0.009202396
++> with(dune.env, plot(A1, pred[,"A1"] - A1, ylab="Prediction Error"))
++> abline(h=0)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("procrustes")
++> ### * procrustes
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: procrustes
++> ### Title: Procrustes Rotation of Two Configurations and PROTEST
++> ### Aliases: procrustes summary.procrustes plot.procrustes
++> ###   points.procrustes text.procrustes lines.procrustes
++> ###   residuals.procrustes fitted.procrustes predict.procrustes protest
++> ### Keywords: multivariate htest
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> vare.dist <- vegdist(wisconsin(varespec))
++> mds.null <- monoMDS(vare.dist, y = cmdscale(vare.dist))
++> mds.alt <- monoMDS(vare.dist)
++> vare.proc <- procrustes(mds.alt, mds.null)
++> vare.proc
++
++Call:
++procrustes(X = mds.alt, Y = mds.null) 
++
++Procrustes sum of squares:
++13.14 
++
++> summary(vare.proc)
++
++Call:
++procrustes(X = mds.alt, Y = mds.null) 
++
++Number of objects: 24    Number of dimensions: 2 
++
++Procrustes sum of squares:  
++  13.1368 
++Procrustes root mean squared error: 
++ 0.7398422 
++Quantiles of Procrustes errors:
++       Min         1Q     Median         3Q        Max 
++0.02033237 0.27686842 0.34124239 0.64358542 2.23460567 
++
++Rotation matrix:
++          [,1]       [,2]
++[1,] 0.9933117 -0.1154641
++[2,] 0.1154641  0.9933117
++
++Translation of averages:
++             [,1]         [,2]
++[1,] 3.038945e-17 1.218602e-17
++
++Scaling of target:
++[1] 0.6727804
++
++> plot(vare.proc)
++> plot(vare.proc, kind=2)
++> residuals(vare.proc)
++        18         15         24         27         23         19         22 
++0.28003467 0.13180094 1.72990690 0.63953155 0.37177564 0.11807007 0.38558576 
++        16         28         13         14         20         25          7 
++0.28008711 1.22839229 0.65574702 0.26736966 0.02033237 0.35725398 0.28654874 
++         5          6          3          4          2          9         12 
++0.69324047 0.20264726 0.29744269 0.50070811 2.23460567 0.31901411 0.21727135 
++        10         11         21 
++0.32523080 0.56506437 0.78179902 
++> 
++> 
++> 
++> cleanEx()
++> nameEx("pyrifos")
++> ### * pyrifos
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: pyrifos
++> ### Title: Response of Aquatic Invertebrates to Insecticide Treatment
++> ### Aliases: pyrifos
++> ### Keywords: datasets
++> 
++> ### ** Examples
++> 
++> data(pyrifos)
++> ditch <- gl(12, 1, length=132)
++> week <- gl(11, 12, labels=c(-4, -1, 0.1, 1, 2, 4, 8, 12, 15, 19, 24))
++> dose <- factor(rep(c(0.1, 0, 0, 0.9, 0, 44, 6, 0.1, 44, 0.9, 0, 6), 11))
++> 
++> 
++> 
++> cleanEx()
++> nameEx("radfit")
++> ### * radfit
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: radfit
++> ### Title: Rank - Abundance or Dominance / Diversity Models
++> ### Aliases: radfit radfit.default radfit.data.frame AIC.radfit
++> ###   AIC.radfit.frame as.rad coef.radfit coef.radfit.frame deviance.radfit
++> ###   deviance.radfit.frame 'logLik, radfit' 'logLik, radfit.frame'
++> ###   fitted.radfit fitted.radfit.frame lines.radline lines.radfit
++> ###   plot.radfit.frame plot.radfit plot.radline plot.rad radlattice
++> ###   points.radline points.radfit summary.radfit.frame rad.preempt
++> ###   rad.lognormal rad.zipf rad.zipfbrot rad.null predict.radline
++> ###   predict.radfit predict.radfit.frame
++> ### Keywords: univar distribution
++> 
++> ### ** Examples
++> 
++> data(BCI)
++> mod <- rad.lognormal(BCI[5,])
++> mod
++
++RAD model: Log-Normal 
++Family: poisson 
++No. of species:  101 
++Total abundance: 505 
++
++    log.mu  log.sigma   Deviance        AIC        BIC 
++  0.951926   1.165929  17.077549 317.656487 322.886728 
++> plot(mod)
++> mod <- radfit(BCI[1,])
++> ## Standard plot overlaid for all models
++> ## Pre-emption model is a line
++> plot(mod)
++> ## log for both axes: Zipf model is a line
++> plot(mod, log = "xy")
++> ## Lattice graphics separately for each model
++> radlattice(mod)
++> # Take a subset of BCI to save time and nerves
++> mod <- radfit(BCI[3:5,])
++> mod
++
++Deviance for RAD models:
++
++                 3       4      5
++Null       86.1127 49.8111 80.855
++Preemption 58.9295 39.7817 76.311
++Lognormal  29.2719 16.6588 17.078
++Zipf       50.1262 47.9108 30.936
++Mandelbrot  5.7342  5.5665 10.573
++> plot(mod, pch=".")
++> 
++> 
++> 
++> cleanEx()
++> nameEx("rankindex")
++> ### * rankindex
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: rankindex
++> ### Title: Compares Dissimilarity Indices for Gradient Detection
++> ### Aliases: rankindex
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> data(varechem)
++> ## The variables are automatically scaled
++> rankindex(varechem, varespec)
++      euc       man       gow       bra       kul 
++0.2396330 0.2735087 0.2288358 0.2837910 0.2839834 
++> rankindex(varechem, wisconsin(varespec))
++      euc       man       gow       bra       kul 
++0.4200990 0.4215642 0.3708606 0.4215642 0.4215642 
++> ## Using non vegdist indices as functions
++> funs <- list(Manhattan=function(x) dist(x, "manhattan"),
+++     Gower=function(x) cluster:::daisy(x, "gower"),
+++     Ochiai=function(x) designdist(x, "1-J/sqrt(A*B)"))
++> rankindex(scale(varechem), varespec, funs)
++Manhattan     Gower    Ochiai 
++0.2735087 0.2288358 0.1696862 
++> 
++> 
++> 
++> cleanEx()
++> nameEx("rarefy")
++> ### * rarefy
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: rarefy
++> ### Title: Rarefaction Species Richness
++> ### Aliases: rarefy rrarefy drarefy rarecurve rareslope
++> ### Keywords: univar
++> 
++> ### ** Examples
++> 
++> data(BCI)
++> S <- specnumber(BCI) # observed number of species
++> (raremax <- min(rowSums(BCI)))
++[1] 340
++> Srare <- rarefy(BCI, raremax)
++> plot(S, Srare, xlab = "Observed No. of Species", ylab = "Rarefied No. of Species")
++> abline(0, 1)
++> rarecurve(BCI, step = 20, sample = raremax, col = "blue", cex = 0.6)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("raupcrick")
++> ### * raupcrick
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: raupcrick
++> ### Title: Raup-Crick Dissimilarity with Unequal Sampling Densities of
++> ###   Species
++> ### Aliases: raupcrick
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> ## data set with variable species richness
++> data(sipoo)
++> ## default raupcrick
++> dr1 <- raupcrick(sipoo)
++> ## use null model "r0" of oecosimu
++> dr0 <- raupcrick(sipoo, null = "r0")
++> ## vegdist(..., method = "raup") corresponds to 'null = "r0"'
++> d <- vegdist(sipoo, "raup")
++> op <- par(mfrow=c(2,1), mar=c(4,4,1,1)+.1)
++> plot(dr1 ~ d, xlab = "Raup-Crick with Null R1", ylab="vegdist")
++> plot(dr0 ~ d, xlab = "Raup-Crick with Null R0", ylab="vegdist")
++> par(op)
++> 
++> ## The calculation is essentially as in the following oecosimu() call,
++> ## except that designdist() is replaced with faster code
++> ## Not run: ##D 
++> ##D oecosimu(sipoo, function(x) designdist(x, "J", "binary"), method = "r1")
++> ## End(Not run)
++> 
++> 
++> 
++> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
++> cleanEx()
++> nameEx("read.cep")
++> ### * read.cep
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: read.cep
++> ### Title: Reads a CEP (Canoco) data file
++> ### Aliases: read.cep
++> ### Keywords: IO file
++> 
++> ### ** Examples
++> 
++> ## Provided that you have the file `dune.spe'
++> ## Not run: 
++> ##D theclassic <- read.cep("dune.spe", force=T)
++> ## End(Not run)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("renyi")
++> ### * renyi
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: renyi
++> ### Title: Renyi and Hill Diversities and Corresponding Accumulation Curves
++> ### Aliases: renyi plot.renyi renyiaccum plot.renyiaccum persp.renyiaccum
++> ### Keywords: univar
++> 
++> ### ** Examples
++> 
++> data(BCI)
++> i <- sample(nrow(BCI), 12)
++> mod <- renyi(BCI[i,])
++> plot(mod)
++> mod <- renyiaccum(BCI[i,])
++> plot(mod, as.table=TRUE, col = c(1, 2, 2))
++> persp(mod)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("reorder.hclust")
++> ### * reorder.hclust
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: reorder.hclust
++> ### Title: Reorder a Hierarchical Clustering Tree
++> ### Aliases: reorder.hclust rev.hclust scores.hclust
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> ## reorder by water content of soil
++> data(mite, mite.env)
++> hc <- hclust(vegdist(wisconsin(sqrt(mite))))
++> ohc <- with(mite.env, reorder(hc, WatrCont))
++> plot(hc)
++> plot(ohc)
++> 
++> ## label leaves by the observed value, and each branching point
++> ## (internal node) by the cluster mean
++> with(mite.env, plot(ohc, labels=round(WatrCont), cex=0.7))
++> ordilabel(scores(ohc), label=round(ohc$value), cex=0.7)
++> 
++> ## Slightly different from reordered 'dendrogram' which ignores group
++> ## sizes in assessing means.
++> den <- as.dendrogram(hc)
++> den <- with(mite.env, reorder(den, WatrCont, agglo.FUN = mean))
++> plot(den)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("scores")
++> ### * scores
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: scores
++> ### Title: Get Species or Site Scores from an Ordination
++> ### Aliases: scores scores.default scores.lda
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> vare.pca <- prcomp(varespec)
++> scores(vare.pca, choices=c(1,2))
++           PC1         PC2
++18 -10.7847878  18.7094315
++15 -27.8036826 -11.7414745
++24 -25.6919559 -14.5399684
++27 -31.7820166 -31.2216800
++23 -19.6315869  -2.5541193
++19  -0.2413294 -11.4974077
++22 -26.6771373 -12.3140897
++16 -21.9230366   0.4449159
++28 -39.6083051 -41.8877392
++13  -4.0664328  20.4191153
++14 -18.4416245   5.4406988
++20 -17.3999191   2.3653380
++25 -25.1673547 -13.2508067
++7  -11.4065430  41.7356300
++5   -8.4243752  45.3805255
++6   -2.0759474  36.9311222
++3   39.8617580   8.0590041
++4   13.1065901  12.8377217
++2   57.6827011  -4.8983565
++9   63.3138332 -22.4481549
++12  44.1073111 -10.1653935
++10  64.9418975 -16.7633564
++11  11.5313633   3.9720890
++21  -3.4194194  -3.0130455
++> 
++> 
++> 
++> cleanEx()
++> nameEx("screeplot.cca")
++> ### * screeplot.cca
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: screeplot.cca
++> ### Title: Screeplots for Ordination Results and Broken Stick Distributions
++> ### Aliases: screeplot.cca screeplot.princomp screeplot.prcomp
++> ###   screeplot.decorana bstick bstick.default bstick.cca bstick.prcomp
++> ###   bstick.princomp bstick.decorana
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> vare.pca <- rda(varespec, scale = TRUE)
++> bstick(vare.pca)
++      PC1       PC2       PC3       PC4       PC5       PC6       PC7       PC8 
++7.1438620 5.2308185 4.2742968 3.6366156 3.1583548 2.7757461 2.4569055 2.1836136 
++      PC9      PC10      PC11      PC12      PC13      PC14      PC15      PC16 
++1.9444831 1.7319228 1.5406184 1.3667054 1.2072851 1.0601279 0.9234819 0.7959457 
++     PC17      PC18      PC19      PC20      PC21      PC22      PC23 
++0.6763805 0.5638485 0.4575683 0.3568818 0.2612296 0.1701323 0.0831758 
++> screeplot(vare.pca, bstick = TRUE, type = "lines")
++> 
++> 
++> 
++> cleanEx()
++> nameEx("simper")
++> ### * simper
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: simper
++> ### Title: Similarity Percentages
++> ### Aliases: simper summary.simper
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(dune)
++> data(dune.env)
++> (sim <- with(dune.env, simper(dune, Management)))
++cumulative contributions of most influential species:
++
++$SF_BF
++  Agrostol   Alopgeni   Lolipere   Trifrepe    Poatriv   Scorautu   Bromhord 
++0.09824271 0.18254830 0.25956958 0.33367870 0.40734444 0.47729205 0.53120026 
++  Achimill   Planlanc   Elymrepe   Bracruta 
++0.57946526 0.62522255 0.67016196 0.71098133 
++
++$SF_HF
++  Agrostol   Alopgeni   Lolipere   Planlanc   Rumeacet   Elymrepe    Poatriv 
++0.08350879 0.16534834 0.23934930 0.30843624 0.37716139 0.43334492 0.48351753 
++  Bracruta   Eleopalu    Poaprat   Anthodor   Sagiproc   Trifprat 
++0.52804045 0.57205850 0.61423981 0.65549838 0.69628951 0.73696831 
++
++$SF_NM
++  Poatriv  Alopgeni  Agrostol  Lolipere  Eleopalu   Poaprat  Bracruta  Elymrepe 
++0.1013601 0.1935731 0.2667383 0.3377578 0.3999419 0.4526707 0.5044725 0.5505643 
++ Scorautu  Trifrepe  Sagiproc  Salirepe 
++0.5926117 0.6320111 0.6712478 0.7091528 
++
++$BF_HF
++  Rumeacet    Poatriv   Planlanc   Bromhord   Lolipere   Elymrepe   Trifrepe 
++0.08163219 0.15193797 0.21918333 0.27967181 0.33969561 0.39843338 0.45298204 
++  Anthodor   Achimill   Bracruta   Alopgeni   Trifprat   Juncarti 
++0.50276849 0.55222648 0.60021994 0.64584333 0.69126471 0.73366621 
++
++$BF_NM
++ Lolipere   Poatriv   Poaprat  Trifrepe  Bromhord  Bracruta  Eleopalu  Agrostol 
++0.1242718 0.1992126 0.2711756 0.3414609 0.3958520 0.4448077 0.4910724 0.5369083 
++ Achimill  Scorautu  Anthodor  Planlanc 
++0.5823926 0.6253645 0.6638182 0.7012577 
++
++$HF_NM
++   Poatriv   Lolipere   Rumeacet    Poaprat   Planlanc   Bracruta   Eleopalu 
++0.09913221 0.17468460 0.23917190 0.29701331 0.35469313 0.40365488 0.44804851 
++  Agrostol   Trifrepe   Elymrepe   Anthodor   Juncarti   Trifprat   Salirepe 
++0.49226546 0.53434466 0.57564661 0.61543243 0.65341300 0.68921695 0.72432408 
++
++> summary(sim)
++
++Contrast: SF_BF 
++
++          average       sd  ratio    ava    avb  cumsum
++Agrostol 0.061374 0.034193 1.7949 4.6667 0.0000 0.09824
++Alopgeni 0.052667 0.036476 1.4439 4.3333 0.6667 0.18255
++Lolipere 0.048116 0.039445 1.2198 3.0000 6.0000 0.25957
++Trifrepe 0.046297 0.025525 1.8138 1.3333 4.6667 0.33368
++Poatriv  0.046020 0.033801 1.3615 4.6667 3.6667 0.40734
++Scorautu 0.043697 0.024922 1.7534 1.3333 4.3333 0.47729
++Bromhord 0.033677 0.025860 1.3023 0.5000 2.6667 0.53120
++Achimill 0.030152 0.020821 1.4482 0.1667 2.3333 0.57947
++Planlanc 0.028585 0.021549 1.3265 0.0000 2.0000 0.62522
++Elymrepe 0.028074 0.029778 0.9428 2.0000 1.3333 0.67016
++Bracruta 0.025501 0.023902 1.0669 2.0000 2.0000 0.71098
++Poaprat  0.025129 0.023967 1.0485 2.5000 4.0000 0.75121
++Sagiproc 0.024326 0.022149 1.0983 1.8333 0.6667 0.79014
++Bellpere 0.019859 0.017088 1.1622 0.6667 1.6667 0.82193
++Eleopalu 0.018611 0.042958 0.4333 1.3333 0.0000 0.85172
++Anthodor 0.017543 0.025804 0.6798 0.0000 1.3333 0.87981
++Juncbufo 0.016031 0.023708 0.6762 1.1667 0.0000 0.90547
++Vicilath 0.014671 0.013306 1.1026 0.0000 1.0000 0.92895
++Hyporadi 0.010286 0.015198 0.6768 0.0000 0.6667 0.94542
++Ranuflam 0.009306 0.013595 0.6845 0.6667 0.0000 0.96031
++Juncarti 0.006979 0.016109 0.4333 0.5000 0.0000 0.97148
++Callcusp 0.006979 0.016109 0.4333 0.5000 0.0000 0.98266
++Rumeacet 0.004526 0.010444 0.4333 0.3333 0.0000 0.98990
++Cirsarve 0.003983 0.009185 0.4336 0.3333 0.0000 0.99628
++Chenalbu 0.002326 0.005370 0.4333 0.1667 0.0000 1.00000
++Airaprae 0.000000 0.000000    NaN 0.0000 0.0000 1.00000
++Comapalu 0.000000 0.000000    NaN 0.0000 0.0000 1.00000
++Empenigr 0.000000 0.000000    NaN 0.0000 0.0000 1.00000
++Salirepe 0.000000 0.000000    NaN 0.0000 0.0000 1.00000
++Trifprat 0.000000 0.000000    NaN 0.0000 0.0000 1.00000
++
++Contrast: SF_HF 
++
++          average       sd  ratio    ava avb  cumsum
++Agrostol 0.047380 0.031273 1.5151 4.6667 1.4 0.08351
++Alopgeni 0.046433 0.032897 1.4115 4.3333 1.6 0.16535
++Lolipere 0.041986 0.027007 1.5546 3.0000 4.0 0.23935
++Planlanc 0.039198 0.033208 1.1804 0.0000 3.0 0.30844
++Rumeacet 0.038992 0.027369 1.4247 0.3333 3.2 0.37716
++Elymrepe 0.031877 0.029550 1.0787 2.0000 2.0 0.43334
++Poatriv  0.028466 0.021522 1.3227 4.6667 4.8 0.48352
++Bracruta 0.025261 0.021044 1.2004 2.0000 2.8 0.52804
++Eleopalu 0.024974 0.038877 0.6424 1.3333 0.8 0.57206
++Poaprat  0.023932 0.019180 1.2478 2.5000 3.4 0.61424
++Anthodor 0.023409 0.021430 1.0923 0.0000 1.8 0.65550
++Sagiproc 0.023144 0.020479 1.1301 1.8333 0.8 0.69629
++Trifprat 0.023080 0.023432 0.9850 0.0000 1.8 0.73697
++Juncarti 0.022850 0.025677 0.8899 0.5000 1.6 0.77724
++Trifrepe 0.022383 0.019487 1.1486 1.3333 2.8 0.81669
++Juncbufo 0.021643 0.022237 0.9733 1.1667 1.2 0.85484
++Scorautu 0.020509 0.016422 1.2489 1.3333 2.8 0.89099
++Achimill 0.015183 0.011393 1.3326 0.1667 1.2 0.91775
++Bromhord 0.013375 0.014504 0.9222 0.5000 0.8 0.94132
++Ranuflam 0.010661 0.013387 0.7964 0.6667 0.4 0.96011
++Bellpere 0.009991 0.012571 0.7948 0.6667 0.4 0.97772
++Callcusp 0.006623 0.015076 0.4393 0.5000 0.0 0.98939
++Cirsarve 0.003809 0.008669 0.4394 0.3333 0.0 0.99611
++Chenalbu 0.002208 0.005025 0.4393 0.1667 0.0 1.00000
++Airaprae 0.000000 0.000000    NaN 0.0000 0.0 1.00000
++Comapalu 0.000000 0.000000    NaN 0.0000 0.0 1.00000
++Empenigr 0.000000 0.000000    NaN 0.0000 0.0 1.00000
++Hyporadi 0.000000 0.000000    NaN 0.0000 0.0 1.00000
++Salirepe 0.000000 0.000000    NaN 0.0000 0.0 1.00000
++Vicilath 0.000000 0.000000    NaN 0.0000 0.0 1.00000
++
++Contrast: SF_NM 
++
++          average       sd  ratio    ava    avb cumsum
++Poatriv  0.078284 0.040947 1.9118 4.6667 0.0000 0.1014
++Alopgeni 0.071219 0.046958 1.5167 4.3333 0.0000 0.1936
++Agrostol 0.056508 0.044176 1.2792 4.6667 2.1667 0.2667
++Lolipere 0.054851 0.059914 0.9155 3.0000 0.3333 0.3378
++Eleopalu 0.048027 0.047168 1.0182 1.3333 2.1667 0.3999
++Poaprat  0.040724 0.031790 1.2810 2.5000 0.6667 0.4527
++Bracruta 0.040008 0.034398 1.1631 2.0000 2.8333 0.5045
++Elymrepe 0.035598 0.038515 0.9243 2.0000 0.0000 0.5506
++Scorautu 0.032475 0.034813 0.9328 1.3333 3.1667 0.5926
++Trifrepe 0.030430 0.031634 0.9619 1.3333 1.8333 0.6320
++Sagiproc 0.030304 0.030477 0.9943 1.8333 0.5000 0.6712
++Salirepe 0.029275 0.032014 0.9144 0.0000 1.8333 0.7092
++Anthodor 0.024541 0.036694 0.6688 0.0000 1.3333 0.7409
++Callcusp 0.022763 0.029443 0.7731 0.5000 1.1667 0.7704
++Ranuflam 0.022566 0.022819 0.9889 0.6667 1.3333 0.7996
++Juncarti 0.022543 0.028598 0.7883 0.5000 1.1667 0.8288
++Hyporadi 0.020108 0.031291 0.6426 0.0000 1.1667 0.8548
++Juncbufo 0.019860 0.029034 0.6840 1.1667 0.0000 0.8806
++Planlanc 0.015420 0.022769 0.6772 0.0000 0.8333 0.9005
++Airaprae 0.014883 0.021881 0.6802 0.0000 0.8333 0.9198
++Bellpere 0.012317 0.015921 0.7737 0.6667 0.3333 0.9357
++Comapalu 0.011883 0.017407 0.6826 0.0000 0.6667 0.9511
++Achimill 0.009294 0.014931 0.6224 0.1667 0.3333 0.9632
++Bromhord 0.007172 0.016333 0.4391 0.5000 0.0000 0.9724
++Rumeacet 0.005590 0.012751 0.4384 0.3333 0.0000 0.9797
++Empenigr 0.005225 0.012001 0.4354 0.0000 0.3333 0.9864
++Cirsarve 0.004782 0.010889 0.4391 0.3333 0.0000 0.9926
++Chenalbu 0.002893 0.006602 0.4382 0.1667 0.0000 0.9964
++Vicilath 0.002792 0.006425 0.4345 0.0000 0.1667 1.0000
++Trifprat 0.000000 0.000000    NaN 0.0000 0.0000 1.0000
++
++Contrast: BF_HF 
++
++          average      sd  ratio    ava avb  cumsum
++Rumeacet 0.038666 0.02606 1.4838 0.0000 3.2 0.08163
++Poatriv  0.033301 0.02579 1.2911 3.6667 4.8 0.15194
++Planlanc 0.031852 0.01830 1.7401 2.0000 3.0 0.21918
++Bromhord 0.028651 0.01799 1.5926 2.6667 0.8 0.27967
++Lolipere 0.028431 0.02215 1.2834 6.0000 4.0 0.33970
++Elymrepe 0.027822 0.02959 0.9404 1.3333 2.0 0.39843
++Trifrepe 0.025838 0.01656 1.5603 4.6667 2.8 0.45298
++Anthodor 0.023582 0.02042 1.1547 1.3333 1.8 0.50277
++Achimill 0.023426 0.01474 1.5893 2.3333 1.2 0.55223
++Bracruta 0.022733 0.01802 1.2617 2.0000 2.8 0.60022
++Alopgeni 0.021610 0.02308 0.9363 0.6667 1.6 0.64584
++Trifprat 0.021514 0.02207 0.9747 0.0000 1.8 0.69126
++Juncarti 0.020084 0.02555 0.7860 0.0000 1.6 0.73367
++Scorautu 0.019318 0.01356 1.4241 4.3333 2.8 0.77445
++Bellpere 0.018290 0.01486 1.2305 1.6667 0.4 0.81306
++Agrostol 0.017605 0.02284 0.7708 0.0000 1.4 0.85023
++Juncbufo 0.015000 0.02066 0.7260 0.0000 1.2 0.88190
++Vicilath 0.012848 0.01140 1.1274 1.0000 0.0 0.90903
++Sagiproc 0.011685 0.01297 0.9008 0.6667 0.8 0.93369
++Eleopalu 0.010169 0.02111 0.4817 0.0000 0.8 0.95516
++Hyporadi 0.008950 0.01312 0.6824 0.6667 0.0 0.97406
++Poaprat  0.007203 0.01010 0.7133 4.0000 3.4 0.98927
++Ranuflam 0.005084 0.01055 0.4817 0.0000 0.4 1.00000
++Airaprae 0.000000 0.00000    NaN 0.0000 0.0 1.00000
++Chenalbu 0.000000 0.00000    NaN 0.0000 0.0 1.00000
++Cirsarve 0.000000 0.00000    NaN 0.0000 0.0 1.00000
++Comapalu 0.000000 0.00000    NaN 0.0000 0.0 1.00000
++Empenigr 0.000000 0.00000    NaN 0.0000 0.0 1.00000
++Salirepe 0.000000 0.00000    NaN 0.0000 0.0 1.00000
++Callcusp 0.000000 0.00000    NaN 0.0000 0.0 1.00000
++
++Contrast: BF_NM 
++
++          average      sd  ratio    ava    avb cumsum
++Lolipere 0.090681 0.02644 3.4292 6.0000 0.3333 0.1243
++Poatriv  0.054684 0.04465 1.2248 3.6667 0.0000 0.1992
++Poaprat  0.052511 0.01813 2.8966 4.0000 0.6667 0.2712
++Trifrepe 0.051287 0.02756 1.8611 4.6667 1.8333 0.3415
++Bromhord 0.039689 0.02920 1.3590 2.6667 0.0000 0.3959
++Bracruta 0.035723 0.02869 1.2452 2.0000 2.8333 0.4448
++Eleopalu 0.033759 0.03573 0.9449 0.0000 2.1667 0.4911
++Agrostol 0.033446 0.03473 0.9630 0.0000 2.1667 0.5369
++Achimill 0.033190 0.02338 1.4198 2.3333 0.3333 0.5824
++Scorautu 0.031356 0.02026 1.5480 4.3333 3.1667 0.6254
++Anthodor 0.028060 0.03295 0.8517 1.3333 1.3333 0.6638
++Planlanc 0.027319 0.02193 1.2458 2.0000 0.8333 0.7013
++Salirepe 0.026770 0.02927 0.9145 0.0000 1.8333 0.7379
++Bellpere 0.023529 0.01909 1.2322 1.6667 0.3333 0.7702
++Hyporadi 0.021721 0.02450 0.8864 0.6667 1.1667 0.8000
++Ranuflam 0.020314 0.02275 0.8928 0.0000 1.3333 0.8278
++Elymrepe 0.019993 0.02926 0.6833 1.3333 0.0000 0.8552
++Callcusp 0.017833 0.02681 0.6653 0.0000 1.1667 0.8796
++Juncarti 0.017694 0.02600 0.6806 0.0000 1.1667 0.9039
++Vicilath 0.015773 0.01447 1.0902 1.0000 0.1667 0.9255
++Sagiproc 0.015432 0.01857 0.8310 0.6667 0.5000 0.9466
++Airaprae 0.013410 0.01969 0.6809 0.0000 0.8333 0.9650
++Comapalu 0.010739 0.01571 0.6835 0.0000 0.6667 0.9797
++Alopgeni 0.009997 0.01463 0.6833 0.6667 0.0000 0.9934
++Empenigr 0.004787 0.01105 0.4332 0.0000 0.3333 1.0000
++Chenalbu 0.000000 0.00000    NaN 0.0000 0.0000 1.0000
++Cirsarve 0.000000 0.00000    NaN 0.0000 0.0000 1.0000
++Juncbufo 0.000000 0.00000    NaN 0.0000 0.0000 1.0000
++Rumeacet 0.000000 0.00000    NaN 0.0000 0.0000 1.0000
++Trifprat 0.000000 0.00000    NaN 0.0000 0.0000 1.0000
++
++Contrast: HF_NM 
++
++          average       sd  ratio ava    avb  cumsum
++Poatriv  0.071553 0.013681 5.2302 4.8 0.0000 0.09913
++Lolipere 0.054533 0.029625 1.8408 4.0 0.3333 0.17468
++Rumeacet 0.046546 0.030806 1.5109 3.2 0.0000 0.23917
++Poaprat  0.041750 0.018852 2.2146 3.4 0.6667 0.29701
++Planlanc 0.041633 0.029560 1.4084 3.0 0.8333 0.35469
++Bracruta 0.035340 0.020104 1.7579 2.8 2.8333 0.40365
++Eleopalu 0.032043 0.032315 0.9916 0.8 2.1667 0.44805
++Agrostol 0.031915 0.028887 1.1048 1.4 2.1667 0.49227
++Trifrepe 0.030372 0.022871 1.3280 2.8 1.8333 0.53434
++Elymrepe 0.029811 0.038676 0.7708 2.0 0.0000 0.57565
++Anthodor 0.028717 0.024799 1.1580 1.8 1.3333 0.61543
++Juncarti 0.027414 0.028537 0.9607 1.6 1.1667 0.65341
++Trifprat 0.025843 0.025972 0.9951 1.8 0.0000 0.68922
++Salirepe 0.025340 0.027291 0.9285 0.0 1.8333 0.72432
++Alopgeni 0.024459 0.032399 0.7549 1.6 0.0000 0.75821
++Scorautu 0.020703 0.014125 1.4658 2.8 3.1667 0.78689
++Ranuflam 0.019285 0.019939 0.9672 0.4 1.3333 0.81361
++Juncbufo 0.018181 0.024648 0.7376 1.2 0.0000 0.83880
++Hyporadi 0.017141 0.026548 0.6457 0.0 1.1667 0.86255
++Callcusp 0.016833 0.024901 0.6760 0.0 1.1667 0.88587
++Achimill 0.016555 0.014900 1.1111 1.2 0.3333 0.90881
++Sagiproc 0.015282 0.016535 0.9243 0.8 0.5000 0.92998
++Airaprae 0.012605 0.018243 0.6910 0.0 0.8333 0.94744
++Bromhord 0.012094 0.015169 0.7973 0.8 0.0000 0.96420
++Comapalu 0.010105 0.014556 0.6942 0.0 0.6667 0.97820
++Bellpere 0.008801 0.013732 0.6409 0.4 0.3333 0.99039
++Empenigr 0.004536 0.010325 0.4393 0.0 0.3333 0.99668
++Vicilath 0.002399 0.005461 0.4393 0.0 0.1667 1.00000
++Chenalbu 0.000000 0.000000    NaN 0.0 0.0000 1.00000
++Cirsarve 0.000000 0.000000    NaN 0.0 0.0000 1.00000
++Permutation: free
++Number of permutations: 0
++> 
++> 
++> 
++> cleanEx()
++> nameEx("simulate.rda")
++> ### * simulate.rda
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: simulate.rda
++> ### Title: Simulate Responses with Gaussian Error or Permuted Residuals for
++> ###   Constrained Ordination
++> ### Aliases: simulate.rda simulate.cca simulate.capscale
++> ### Keywords: models datagen multivariate
++> 
++> ### ** Examples
++> 
++> data(dune)
++> data(dune.env)
++> mod <- rda(dune ~  Moisture + Management, dune.env)
++> ## One simulation
++> update(mod, simulate(mod) ~  .)
++Call: rda(formula = simulate(mod) ~ Moisture + Management, data =
++dune.env)
++
++              Inertia Proportion Rank
++Total         82.8232     1.0000     
++Constrained   52.6966     0.6363    6
++Unconstrained 30.1266     0.3637   13
++Inertia is variance 
++
++Eigenvalues for constrained axes:
++  RDA1   RDA2   RDA3   RDA4   RDA5   RDA6 
++22.011 15.693  6.034  4.165  3.265  1.529 
++
++Eigenvalues for unconstrained axes:
++  PC1   PC2   PC3   PC4   PC5   PC6   PC7   PC8   PC9  PC10  PC11  PC12  PC13 
++6.524 4.747 3.703 3.119 2.963 2.279 1.782 1.440 1.251 0.858 0.613 0.477 0.369 
++
++> ## An impression of confidence regions of site scores
++> plot(mod, display="sites")
++> for (i in 1:5) lines(procrustes(mod, update(mod, simulate(mod) ~ .)), col="blue")
++> ## Simulate a set of null communities with permutation of residuals
++> simulate(mod, indx = shuffleSet(nrow(dune), 99))
++An object of class “simulate.rda” 
++‘simulate index’ method (abundance, non-sequential)
++20 x 30 matrix
++Number of permuted matrices = 99 
++
++> 
++> 
++> 
++> cleanEx()
++> nameEx("sipoo")
++> ### * sipoo
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: sipoo
++> ### Title: Birds in the Archipelago of Sipoo (Sibbo)
++> ### Aliases: sipoo
++> ### Keywords: datasets
++> 
++> ### ** Examples
++> 
++> data(sipoo)
++> ## Areas of the islands in hectares
++> sipoo.area <-  c(1.1, 2.1, 2.2, 3.1, 3.5, 5.8, 6, 6.1, 6.5, 11.4, 13,
+++ 14.5, 16.1 ,17.5, 28.7, 40.5, 104.5, 233) 
++> 
++> 
++> 
++> cleanEx()
++> nameEx("spantree")
++> ### * spantree
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: spantree
++> ### Title: Minimum Spanning Tree
++> ### Aliases: spantree cophenetic.spantree as.hclust.spantree plot.spantree
++> ###   lines.spantree spandepth
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(dune)
++> dis <- vegdist(dune)
++> tr <- spantree(dis)
++> ## Add tree to a metric scaling 
++> plot(tr, cmdscale(dis), type = "t")
++> ## Find a configuration to display the tree neatly
++> plot(tr, type = "t")
++Initial stress        : 0.03111
++stress after  10 iters: 0.01302, magic = 0.500
++stress after  20 iters: 0.01139, magic = 0.500
++stress after  30 iters: 0.01118, magic = 0.500
++stress after  40 iters: 0.01114, magic = 0.500
++> ## Depths of nodes
++> depths <- spandepth(tr)
++> plot(tr, type = "t", label = depths)
++Initial stress        : 0.03111
++stress after  10 iters: 0.01302, magic = 0.500
++stress after  20 iters: 0.01139, magic = 0.500
++stress after  30 iters: 0.01118, magic = 0.500
++stress after  40 iters: 0.01114, magic = 0.500
++> ## Plot as a dendrogram
++> cl <- as.hclust(tr)
++> plot(cl)
++> ## cut hclust tree to classes and show in colours in spantree
++> plot(tr, col = cutree(cl, 5), pch=16)
++Initial stress        : 0.03111
++stress after  10 iters: 0.01302, magic = 0.500
++stress after  20 iters: 0.01139, magic = 0.500
++stress after  30 iters: 0.01118, magic = 0.500
++stress after  40 iters: 0.01114, magic = 0.500
++> 
++> 
++> 
++> cleanEx()
++> nameEx("specaccum")
++> ### * specaccum
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: specaccum
++> ### Title: Species Accumulation Curves
++> ### Aliases: specaccum print.specaccum summary.specaccum plot.specaccum
++> ###   lines.specaccum boxplot.specaccum fitspecaccum plot.fitspecaccum
++> ###   lines.fitspecaccum predict.specaccum predict.fitspecaccum
++> ###   AIC.fitspecaccum deviance.fitspecaccum specslope
++> ### Keywords: univar models
++> 
++> ### ** Examples
++> 
++> data(BCI)
++> sp1 <- specaccum(BCI)
++Warning in cor(x > 0) : the standard deviation is zero
++> sp2 <- specaccum(BCI, "random")
++> sp2
++Species Accumulation Curve
++Accumulation method: random, with 100 permutations
++Call: specaccum(comm = BCI, method = "random") 
++
++                                                                             
++Sites     1.00000   2.00000   3.00000   4.00000   5.00000   6.00000   7.00000
++Richness 91.34000 121.01000 138.72000 150.54000 159.54000 166.50000 171.82000
++sd        7.21001   6.92892   6.74811   6.50939   6.12565   5.93483   5.60371
++                                                                              
++Sites      8.00000   9.00000  10.00000  11.00000  12.00000  13.00000  14.00000
++Richness 176.18000 179.79000 182.73000 185.95000 188.59000 191.08000 193.10000
++sd         5.18229   5.12923   5.17542   4.71913   4.52177   4.42144   4.37278
++                                                                             
++Sites     15.00000  16.00000  17.0000  18.00000  19.00000  20.00000  21.00000
++Richness 194.92000 196.87000 198.2700 199.67000 201.00000 202.47000 203.95000
++sd         4.52754   4.42138   4.2873   4.03283   4.00505   3.96819   3.95269
++                                                                            
++Sites     22.00000  23.0000  24.00000  25.00000  26.00000  27.00000  28.0000
++Richness 205.18000 206.2100 207.23000 208.38000 209.39000 210.54000 211.4300
++sd         3.77493   3.6826   3.70055   3.32356   3.32391   3.31638   3.1567
++                                                                             
++Sites     29.0000  30.00000  31.00000  32.00000  33.00000  34.00000  35.00000
++Richness 212.2900 213.23000 214.10000 214.88000 215.62000 216.37000 217.00000
++sd         3.0987   2.95712   2.76157   2.57525   2.52974   2.58846   2.48633
++                                                                              
++Sites     36.00000  37.00000  38.00000  39.00000  40.00000  41.00000  42.00000
++Richness 217.55000 218.16000 218.77000 219.34000 219.97000 220.60000 221.21000
++sd         2.37144   2.36438   2.21042   2.04109   2.07172   1.96433   1.94518
++                                                                               
++Sites     43.00000  44.00000  45.00  46.00000  47.00000  48.00000  49.00000  50
++Richness 221.85000 222.36000 222.89 223.32000 223.71000 224.17000 224.65000 225
++sd         1.77169   1.58605   1.49   1.47628   1.20851   0.97499   0.60927   0
++> summary(sp2)
++ 1 sites          2 sites         3 sites         4 sites        
++ Min.   : 77.00   Min.   :105.0   Min.   :123.0   Min.   :135.0  
++ 1st Qu.: 86.00   1st Qu.:116.0   1st Qu.:133.8   1st Qu.:145.8  
++ Median : 91.00   Median :120.5   Median :140.0   Median :150.5  
++ Mean   : 91.34   Mean   :121.0   Mean   :138.7   Mean   :150.5  
++ 3rd Qu.: 97.00   3rd Qu.:127.0   3rd Qu.:144.0   3rd Qu.:155.0  
++ Max.   :109.00   Max.   :136.0   Max.   :158.0   Max.   :162.0  
++ 5 sites         6 sites         7 sites         8 sites        
++ Min.   :144.0   Min.   :152.0   Min.   :156.0   Min.   :160.0  
++ 1st Qu.:155.0   1st Qu.:162.0   1st Qu.:168.0   1st Qu.:173.0  
++ Median :159.5   Median :167.0   Median :173.0   Median :177.0  
++ Mean   :159.5   Mean   :166.5   Mean   :171.8   Mean   :176.2  
++ 3rd Qu.:164.0   3rd Qu.:171.0   3rd Qu.:175.2   3rd Qu.:179.0  
++ Max.   :174.0   Max.   :180.0   Max.   :183.0   Max.   :187.0  
++ 9 sites         10 sites        11 sites        12 sites       
++ Min.   :161.0   Min.   :164.0   Min.   :174.0   Min.   :178.0  
++ 1st Qu.:177.0   1st Qu.:179.0   1st Qu.:182.8   1st Qu.:186.0  
++ Median :180.0   Median :184.0   Median :187.0   Median :189.0  
++ Mean   :179.8   Mean   :182.7   Mean   :185.9   Mean   :188.6  
++ 3rd Qu.:183.0   3rd Qu.:186.0   3rd Qu.:188.0   3rd Qu.:191.0  
++ Max.   :194.0   Max.   :196.0   Max.   :198.0   Max.   :199.0  
++ 13 sites        14 sites        15 sites        16 sites       
++ Min.   :179.0   Min.   :181.0   Min.   :185.0   Min.   :186.0  
++ 1st Qu.:188.0   1st Qu.:191.0   1st Qu.:192.0   1st Qu.:194.0  
++ Median :191.0   Median :193.0   Median :195.0   Median :197.0  
++ Mean   :191.1   Mean   :193.1   Mean   :194.9   Mean   :196.9  
++ 3rd Qu.:194.0   3rd Qu.:196.0   3rd Qu.:198.0   3rd Qu.:200.0  
++ Max.   :201.0   Max.   :203.0   Max.   :205.0   Max.   :207.0  
++ 17 sites        18 sites        19 sites      20 sites        21 sites       
++ Min.   :187.0   Min.   :189.0   Min.   :189   Min.   :189.0   Min.   :189.0  
++ 1st Qu.:195.8   1st Qu.:197.0   1st Qu.:199   1st Qu.:200.0   1st Qu.:202.0  
++ Median :198.0   Median :200.0   Median :201   Median :202.5   Median :204.0  
++ Mean   :198.3   Mean   :199.7   Mean   :201   Mean   :202.5   Mean   :203.9  
++ 3rd Qu.:201.0   3rd Qu.:202.2   3rd Qu.:204   3rd Qu.:205.0   3rd Qu.:207.0  
++ Max.   :208.0   Max.   :209.0   Max.   :211   Max.   :212.0   Max.   :213.0  
++ 22 sites        23 sites        24 sites        25 sites       
++ Min.   :194.0   Min.   :195.0   Min.   :197.0   Min.   :198.0  
++ 1st Qu.:203.0   1st Qu.:204.0   1st Qu.:205.0   1st Qu.:206.0  
++ Median :205.0   Median :206.5   Median :207.0   Median :209.0  
++ Mean   :205.2   Mean   :206.2   Mean   :207.2   Mean   :208.4  
++ 3rd Qu.:207.2   3rd Qu.:209.0   3rd Qu.:210.0   3rd Qu.:211.0  
++ Max.   :213.0   Max.   :215.0   Max.   :216.0   Max.   :216.0  
++ 26 sites        27 sites        28 sites        29 sites       
++ Min.   :199.0   Min.   :201.0   Min.   :202.0   Min.   :203.0  
++ 1st Qu.:207.0   1st Qu.:208.8   1st Qu.:210.0   1st Qu.:211.0  
++ Median :209.0   Median :211.0   Median :211.0   Median :212.0  
++ Mean   :209.4   Mean   :210.5   Mean   :211.4   Mean   :212.3  
++ 3rd Qu.:212.0   3rd Qu.:213.0   3rd Qu.:214.0   3rd Qu.:214.0  
++ Max.   :218.0   Max.   :218.0   Max.   :218.0   Max.   :219.0  
++ 30 sites        31 sites        32 sites        33 sites       
++ Min.   :203.0   Min.   :204.0   Min.   :206.0   Min.   :206.0  
++ 1st Qu.:211.0   1st Qu.:212.0   1st Qu.:213.0   1st Qu.:214.0  
++ Median :213.0   Median :214.0   Median :215.0   Median :216.0  
++ Mean   :213.2   Mean   :214.1   Mean   :214.9   Mean   :215.6  
++ 3rd Qu.:215.0   3rd Qu.:216.0   3rd Qu.:217.0   3rd Qu.:218.0  
++ Max.   :220.0   Max.   :220.0   Max.   :220.0   Max.   :220.0  
++ 34 sites        35 sites      36 sites        37 sites        38 sites       
++ Min.   :208.0   Min.   :209   Min.   :209.0   Min.   :212.0   Min.   :214.0  
++ 1st Qu.:214.8   1st Qu.:216   1st Qu.:216.0   1st Qu.:217.0   1st Qu.:217.0  
++ Median :216.0   Median :217   Median :218.0   Median :218.0   Median :219.0  
++ Mean   :216.4   Mean   :217   Mean   :217.6   Mean   :218.2   Mean   :218.8  
++ 3rd Qu.:218.0   3rd Qu.:219   3rd Qu.:219.0   3rd Qu.:220.0   3rd Qu.:220.0  
++ Max.   :222.0   Max.   :222   Max.   :223.0   Max.   :223.0   Max.   :224.0  
++ 39 sites        40 sites      41 sites        42 sites        43 sites       
++ Min.   :214.0   Min.   :214   Min.   :216.0   Min.   :216.0   Min.   :217.0  
++ 1st Qu.:218.0   1st Qu.:219   1st Qu.:219.0   1st Qu.:220.0   1st Qu.:221.0  
++ Median :220.0   Median :220   Median :221.0   Median :221.0   Median :222.0  
++ Mean   :219.3   Mean   :220   Mean   :220.6   Mean   :221.2   Mean   :221.8  
++ 3rd Qu.:221.0   3rd Qu.:222   3rd Qu.:222.0   3rd Qu.:223.0   3rd Qu.:223.0  
++ Max.   :224.0   Max.   :224   Max.   :224.0   Max.   :225.0   Max.   :225.0  
++ 44 sites        45 sites        46 sites        47 sites       
++ Min.   :217.0   Min.   :219.0   Min.   :219.0   Min.   :220.0  
++ 1st Qu.:221.8   1st Qu.:222.0   1st Qu.:223.0   1st Qu.:223.0  
++ Median :223.0   Median :223.0   Median :224.0   Median :224.0  
++ Mean   :222.4   Mean   :222.9   Mean   :223.3   Mean   :223.7  
++ 3rd Qu.:223.0   3rd Qu.:224.0   3rd Qu.:224.0   3rd Qu.:225.0  
++ Max.   :225.0   Max.   :225.0   Max.   :225.0   Max.   :225.0  
++ 48 sites        49 sites        50 sites     
++ Min.   :221.0   Min.   :222.0   Min.   :225  
++ 1st Qu.:224.0   1st Qu.:224.0   1st Qu.:225  
++ Median :224.0   Median :225.0   Median :225  
++ Mean   :224.2   Mean   :224.7   Mean   :225  
++ 3rd Qu.:225.0   3rd Qu.:225.0   3rd Qu.:225  
++ Max.   :225.0   Max.   :225.0   Max.   :225  
++> plot(sp1, ci.type="poly", col="blue", lwd=2, ci.lty=0, ci.col="lightblue")
++> boxplot(sp2, col="yellow", add=TRUE, pch="+")
++> ## Fit Lomolino model to the exact accumulation
++> mod1 <- fitspecaccum(sp1, "lomolino")
++> coef(mod1)
++      Asym       xmid      slope 
++258.440682   2.442061   1.858694 
++> fitted(mod1)
++ [1]  94.34749 121.23271 137.45031 148.83053 157.45735 164.31866 169.95946
++ [8] 174.71115 178.78954 182.34254 185.47566 188.26658 190.77402 193.04337
++[15] 195.11033 197.00350 198.74606 200.35705 201.85227 203.24499 204.54643
++[22] 205.76612 206.91229 207.99203 209.01150 209.97609 210.89054 211.75903
++[29] 212.58527 213.37256 214.12386 214.84180 215.52877 216.18692 216.81820
++[36] 217.42437 218.00703 218.56767 219.10762 219.62811 220.13027 220.61514
++[43] 221.08369 221.53679 221.97528 222.39991 222.81138 223.21037 223.59747
++[50] 223.97327
++> plot(sp1)
++> ## Add Lomolino model using argument 'add'
++> plot(mod1, add = TRUE, col=2, lwd=2)
++> ## Fit Arrhenius models to all random accumulations
++> mods <- fitspecaccum(sp2, "arrh")
++> plot(mods, col="hotpink")
++> boxplot(sp2, col = "yellow", border = "blue", lty=1, cex=0.3, add= TRUE)
++> ## Use nls() methods to the list of models
++> sapply(mods$models, AIC)
++  [1] 324.2489 358.8631 357.1474 348.5675 320.8596 362.4988 339.6392 302.6209
++  [9] 325.8906 335.5387 358.2781 347.9665 305.9077 338.6679 331.4992 319.3814
++ [17] 342.8604 308.0547 303.6049 307.0464 324.5011 335.4867 362.7110 342.5750
++ [25] 278.4388 346.3987 314.5455 305.6342 358.2744 307.9340 342.8888 301.1880
++ [33] 341.8359 348.4535 328.1716 341.5565 291.4052 336.6322 349.8087 350.1049
++ [41] 349.5025 352.0225 308.1040 322.4882 322.5936 361.7398 353.0302 350.8482
++ [49] 325.5460 360.2195 345.9105 342.7948 351.8214 267.6483 332.0333 320.1204
++ [57] 313.6519 344.1718 346.6968 311.0463 334.1548 368.1168 299.7756 322.6268
++ [65] 364.3129 353.3865 327.4970 343.1699 350.5206 316.0220 302.6937 286.5891
++ [73] 329.5312 323.6312 355.3245 322.2671 339.8070 367.4518 336.2615 323.6332
++ [81] 330.1162 309.3435 352.7868 321.6770 310.2606 326.1316 342.7621 333.2059
++ [89] 321.3756 368.4900 363.6466 326.1864 292.2932 296.4067 361.3046 356.2217
++ [97] 350.8804 359.9127 344.3568 332.4569
++> 
++> 
++> 
++> cleanEx()
++> nameEx("specpool")
++> ### * specpool
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: specpool
++> ### Title: Extrapolated Species Richness in a Species Pool
++> ### Aliases: specpool specpool2vect poolaccum summary.poolaccum
++> ###   plot.poolaccum estimateR estimateR.default estimateR.matrix
++> ###   estimateR.data.frame estaccumR
++> ### Keywords: univar
++> 
++> ### ** Examples
++> 
++> data(dune)
++> data(dune.env)
++> attach(dune.env)
++> pool <- specpool(dune, Management)
++> pool
++   Species     chao   chao.se    jack1 jack1.se    jack2     boot  boot.se n
++BF      16 17.19048 1.5895675 19.33333 2.211083 19.83333 17.74074 1.646379 3
++HF      21 21.51429 0.9511693 23.40000 1.876166 22.05000 22.56864 1.821518 5
++NM      21 22.87500 2.1582871 26.00000 3.291403 25.73333 23.77696 2.300982 6
++SF      21 29.88889 8.6447967 27.66667 3.496029 31.40000 23.99496 1.850288 6
++> op <- par(mfrow=c(1,2))
++> boxplot(specnumber(dune) ~ Management, col="hotpink", border="cyan3",
+++  notch=TRUE)
++Warning in bxp(list(stats = c(9, 9.5, 10, 11, 12, 11, 12, 13, 13, 14, 7,  :
++  some notches went outside hinges ('box'): maybe set notch=FALSE
++> boxplot(specnumber(dune)/specpool2vect(pool) ~ Management, col="hotpink",
+++  border="cyan3", notch=TRUE)
++Warning in bxp(list(stats = c(0.46551724137931, 0.491379310344828, 0.517241379310345,  :
++  some notches went outside hinges ('box'): maybe set notch=FALSE
++> par(op)
++> data(BCI)
++> ## Accumulation model
++> pool <- poolaccum(BCI)
++> summary(pool, display = "chao")
++$chao
++       N     Chao     2.5%    97.5%   Std.Dev
++ [1,]  3 161.4109 144.6126 178.9871  9.801654
++ [2,]  4 175.3013 156.0120 200.3193 11.771507
++ [3,]  5 184.5183 163.6632 208.8254 11.966732
++ [4,]  6 191.5108 172.6320 217.6871 11.433620
++ [5,]  7 196.1425 177.1485 216.1394 10.300755
++ [6,]  8 199.7655 180.8137 221.8030 11.050654
++ [7,]  9 202.3226 187.6958 226.0312 10.284834
++ [8,] 10 205.1811 187.1814 234.5619 11.982118
++ [9,] 11 208.0594 191.3298 233.2606 11.810585
++[10,] 12 210.7932 192.0850 237.1459 11.336662
++[11,] 13 213.9566 195.3646 237.5129 11.330362
++[12,] 14 216.3246 194.9807 238.0314 11.325669
++[13,] 15 219.0071 196.3220 240.6890 12.073741
++[14,] 16 221.1155 200.1056 241.8803 11.792394
++[15,] 17 221.7125 201.6610 245.1075 11.332692
++[16,] 18 223.6046 203.9908 248.0839 11.722007
++[17,] 19 224.9023 205.7025 249.4671 11.228833
++[18,] 20 227.0483 208.6850 254.0646 13.048967
++[19,] 21 228.6833 208.6412 258.0540 12.722020
++[20,] 22 229.5879 209.7609 253.7754 11.841663
++[21,] 23 230.1766 213.1453 253.7301 10.746815
++[22,] 24 231.5115 213.9103 255.8942 11.014966
++[23,] 25 233.5683 214.6193 259.3002 11.749781
++[24,] 26 233.9382 217.4818 258.2308 11.369741
++[25,] 27 234.8832 218.6546 255.4724 10.158710
++[26,] 28 234.6476 220.7203 255.0633  9.429129
++[27,] 29 235.7344 219.8494 257.2886 10.211869
++[28,] 30 236.5167 222.7719 260.5121  9.947075
++[29,] 31 236.4638 222.9289 256.9346  8.826309
++[30,] 32 237.7034 221.8471 261.0706  9.617682
++[31,] 33 237.1767 223.4613 257.0897  9.058297
++[32,] 34 237.3228 221.7998 256.3574  9.567790
++[33,] 35 237.5354 221.4743 255.5337  9.339085
++[34,] 36 237.2440 222.2844 256.1171  8.837235
++[35,] 37 237.5675 222.4925 256.7364  9.388989
++[36,] 38 237.7059 222.9352 258.7308  9.451033
++[37,] 39 237.9622 224.8405 261.9372  9.479366
++[38,] 40 237.7631 224.9289 258.1333  8.637200
++[39,] 41 238.3850 226.1408 258.9579  8.581810
++[40,] 42 238.8268 225.7357 257.0081  9.731966
++[41,] 43 238.6941 226.0755 254.6363  8.313701
++[42,] 44 238.7041 228.3762 253.0612  7.491410
++[43,] 45 238.5832 229.5340 255.1341  6.571046
++[44,] 46 238.0307 229.2938 250.0349  5.519841
++[45,] 47 237.6838 230.0538 249.1268  4.855208
++[46,] 48 237.3636 232.3044 246.4903  3.952778
++[47,] 49 236.8121 234.3115 245.4082  2.380487
++[48,] 50 236.3732 236.3732 236.3732  0.000000
++
++attr(,"class")
++[1] "summary.poolaccum"
++> plot(pool)
++> ## Quantitative model
++> estimateR(BCI[1:5,])
++                  1          2          3          4          5
++S.obs     93.000000  84.000000  90.000000  94.000000 101.000000
++S.chao1  117.473684 117.214286 141.230769 111.550000 136.000000
++se.chao1  11.583785  15.918953  23.001405   8.919663  15.467344
++S.ACE    122.848959 117.317307 134.669844 118.729941 137.114088
++se.ACE     5.736054   5.571998   6.191618   5.367571   5.848474
++> 
++> 
++> 
++> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
++> cleanEx()
++
++detaching ‘dune.env’
++
++> nameEx("stepacross")
++> ### * stepacross
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: stepacross
++> ### Title: Stepacross as Flexible Shortest Paths or Extended
++> ###   Dissimilarities
++> ### Aliases: stepacross
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> # There are no data sets with high beta diversity in vegan, but this
++> # should give an idea.
++> data(dune)
++> dis <- vegdist(dune)
++> edis <- stepacross(dis)
++Too long or NA distances: 5 out of 190 (2.6%)
++Stepping across 190 dissimilarities...
++> plot(edis, dis, xlab = "Shortest path", ylab = "Original")
++> ## Manhattan distance have no fixed upper limit.
++> dis <- vegdist(dune, "manhattan")
++> is.na(dis) <- no.shared(dune)
++> dis <- stepacross(dis, toolong=0)
++Too long or NA distances: 5 out of 190 (2.6%)
++Stepping across 190 dissimilarities...
++> 
++> 
++> 
++> cleanEx()
++> nameEx("stressplot.wcmdscale")
++> ### * stressplot.wcmdscale
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: stressplot.wcmdscale
++> ### Title: Display Ordination Distances Against Observed Distances in
++> ###   Eigenvector Ordinations
++> ### Aliases: stressplot.wcmdscale stressplot.cca stressplot.rda
++> ###   stressplot.capscale stressplot.dbrda stressplot.prcomp
++> ###   stressplot.princomp
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(dune, dune.env)
++> mod <- rda(dune)
++> stressplot(mod)
++> mod <- rda(dune ~ Management, dune.env)
++> stressplot(mod, k=3)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("taxondive")
++> ### * taxondive
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: taxondive
++> ### Title: Indices of Taxonomic Diversity and Distinctness
++> ### Aliases: taxondive summary.taxondive plot.taxondive taxa2dist
++> ### Keywords: univar
++> 
++> ### ** Examples
++> 
++> ## Preliminary: needs better data and some support functions
++> data(dune)
++> data(dune.taxon)
++> # Taxonomic distances from a classification table with variable step lengths.
++> taxdis <- taxa2dist(dune.taxon, varstep=TRUE)
++> plot(hclust(taxdis), hang = -1)
++> # Indices
++> mod <- taxondive(dune, taxdis)
++> mod
++          Species    Delta   Delta*  Lambda+   Delta+ S Delta+
++1           5.000   25.009   32.154 1592.777   51.545   257.73
++2          10.000   60.493   66.350 1426.590   66.687   666.87
++3          10.000   46.599   51.702 1395.603   70.748   707.47
++4          13.000   58.199   63.176 1258.772   73.403   954.24
++5          14.000   72.045   76.990 1018.677   77.602  1086.43
++6          11.000   76.415   83.121  858.170   80.843   889.27
++7          13.000   70.250   75.475  970.358   78.397  1019.17
++8          12.000   59.126   63.436 1079.722   74.787   897.44
++9          13.000   56.948   60.985 1220.760   71.160   925.08
++10         12.000   68.902   74.513 1028.527   77.762   933.14
++11          9.000   76.201   85.126  552.357   82.538   742.84
++12          9.000   69.555   77.792  760.886   82.614   743.52
++13         10.000   55.296   62.923  935.943   76.657   766.57
++14          7.000   77.609   89.250  341.499   88.182   617.27
++15          8.000   74.924   84.249  473.604   86.558   692.47
++16          8.000   57.843   66.539 1111.251   73.360   586.88
++17          7.000   64.823   72.408 1209.057   70.974   496.82
++18          9.000   76.731   85.773  596.607   81.401   732.61
++19          9.000   73.449   81.318  476.221   83.371   750.34
++20          8.000   78.076   87.063  520.623   87.922   703.38
++Expected            73.289   70.182            78.712         
++> summary(mod)
++           Delta  Delta*  Delta+ sd(Delta+) z(Delta+) Pr(>|z|)   
++1        25.0089 32.1543 51.5455     9.5637   -2.8405 0.004504 **
++2        60.4931 66.3497 66.6869     4.6664   -2.5769 0.009970 **
++3        46.5985 51.7024 70.7475     4.6664   -1.7067 0.087881 . 
++4        58.1988 63.1763 73.4033     3.5073   -1.5135 0.130150   
++5        72.0452 76.9903 77.6024     3.2187   -0.3446 0.730386   
++6        76.4148 83.1205 80.8430     4.2170    0.5054 0.613259   
++7        70.2500 75.4752 78.3974     3.5073   -0.0896 0.928626   
++8        59.1259 63.4363 74.7865     3.8361   -1.0232 0.306220   
++9        56.9481 60.9854 71.1597     3.5073   -2.1532 0.031303 * 
++10       68.9021 74.5133 77.7617     3.8361   -0.2476 0.804432   
++11       76.2014 85.1259 82.5379     5.2089    0.7346 0.462605   
++12       69.5554 77.7922 82.6136     5.2089    0.7491 0.453792   
++13       55.2961 62.9232 76.6566     4.6664   -0.4404 0.659657   
++14       77.6087 89.2500 88.1818     6.7459    1.4039 0.160362   
++15       74.9245 84.2485 86.5584     5.8818    1.3341 0.182178   
++16       57.8435 66.5389 73.3604     5.8818   -0.9098 0.362936   
++17       64.8225 72.4081 70.9740     6.7459   -1.1470 0.251377   
++18       76.7314 85.7730 81.4015     5.2089    0.5164 0.605570   
++19       73.4487 81.3182 83.3712     5.2089    0.8945 0.371029   
++20       78.0762 87.0634 87.9221     5.8818    1.5659 0.117368   
++Expected 73.2888 70.1816 78.7116                                 
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> plot(mod)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("tolerance")
++> ### * tolerance
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: tolerance
++> ### Title: Species tolerances and sample heterogeneities
++> ### Aliases: tolerance tolerance.cca
++> 
++> ### ** Examples
++> 
++> data(dune)
++> data(dune.env)
++> mod <- cca(dune ~ ., data = dune.env)
++> 
++> ## defaults to species tolerances
++> tolerance(mod)
++
++	Species Tolerances
++
++Scaling: 2
++
++              CCA1         CCA2
++Achimill 0.9196092 8.449914e-01
++Agrostol 0.9044440 8.718601e-01
++Airaprae 2.6654621 4.080607e-01
++Alopgeni 0.7709807 3.464157e-01
++Anthodor 1.0199113 7.575379e-01
++Bellpere 1.1104145 9.067794e-01
++Bromhord 1.0381512 5.515502e-01
++Chenalbu 0.6033850 6.883383e-15
++Cirsarve 1.3186022 1.010898e-09
++Comapalu 2.1945688 5.677653e-01
++Eleopalu 1.7007903 8.292822e-01
++Elymrepe 1.3717380 5.135604e-01
++Empenigr 2.8931006 4.260585e-09
++Hyporadi 2.2304480 5.791210e-01
++Juncarti 1.2178954 9.536362e-01
++Juncbufo 1.0888681 5.294370e-01
++Lolipere 1.0576496 7.874610e-01
++Planlanc 0.6397722 6.393173e-01
++Poaprat  1.1008934 9.166587e-01
++Poatriv  1.0732501 7.099165e-01
++Ranuflam 1.8373921 1.059420e+00
++Rumeacet 1.0088537 7.625654e-01
++Sagiproc 1.0449246 1.019154e+00
++Salirepe 2.4879997 8.654457e-02
++Scorautu 1.1072914 1.036536e+00
++Trifprat 0.5623270 2.811272e-01
++Trifrepe 0.8794567 8.738483e-01
++Vicilath 0.6164605 4.896853e-01
++Bracruta 1.1352368 1.051819e+00
++Callcusp 2.4779468 8.464129e-01
++
++> 
++> ## sample heterogeneities for CCA axes 1:6
++> tolerance(mod, which = "sites", choices = 1:6)
++
++	Sample Heterogeneities
++
++Scaling: 2
++
++        CCA1      CCA2      CCA3      CCA4      CCA5      CCA6
++1  1.6160868 0.8611530 1.3611613 0.8547721 0.8880025 1.0054039
++2  0.7379270 0.4136311 0.4814279 0.2579402 0.5508780 0.3008441
++3  1.2043495 0.7279717 1.1259717 0.9726111 0.9957139 0.9500034
++4  1.1765582 0.6901907 1.1813605 0.9080998 1.0242807 0.8926357
++5  0.3568513 0.5614830 0.7904248 0.4439038 0.5395412 0.5563630
++6  0.5242810 0.6867342 1.2883496 0.8121662 0.9649406 0.8990979
++7  0.4780376 0.4993262 0.5981893 0.4002808 0.3971772 0.3037031
++8  0.7500360 0.5498552 0.6659454 0.6745113 0.6543351 0.6517439
++9  1.1531088 0.7399384 1.0907452 1.1959420 0.8945268 1.0529521
++10 0.3560047 0.5806978 0.6260266 0.7902086 0.5703606 0.5987258
++11 0.5680664 0.6016877 0.6052417 0.8408208 0.7677540 0.5231514
++12 1.3520612 1.1084494 1.3764339 1.7806761 1.4762045 1.6001441
++13 1.2059850 0.8859365 1.2589142 1.5498105 1.3904166 1.3897352
++14 1.7981550 0.6747926 0.9814690 1.1843091 0.6378377 0.7056578
++15 0.7836875 0.5294221 0.4075052 0.6010561 0.4589683 0.4276478
++16 0.6799624 0.6058313 0.4878699 0.6155630 0.6700358 0.5629790
++17 2.2689099 1.5142792 2.3067682 2.1185580 2.0873993 2.3439179
++18 1.6837720 1.4067575 1.6687447 1.8211091 1.8556056 1.6626793
++19 1.9282709 0.9816332 1.2377752 1.2116335 1.5379732 1.5270539
++20 2.5707156 1.4458326 1.5654328 1.5825992 1.6868279 1.6688951
++
++> 
++> 
++> 
++> cleanEx()
++> nameEx("treedive")
++> ### * treedive
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: treedive
++> ### Title: Functional Diversity and Community Distances from Species Trees
++> ### Aliases: treedive treeheight treedist
++> ### Keywords: univar
++> 
++> ### ** Examples
++> 
++> 
++> ## There is no data set on species properties yet, and we demonstrate
++> ## the methods using phylogenetic trees
++> data(dune)
++> data(dune.phylodis)
++> cl <- hclust(dune.phylodis)
++> treedive(dune, cl)
++Forced matching of 'tree' labels and 'comm' names
++        1         2         3         4         5         6         7         8 
++ 384.0913  568.8791 1172.9455 1327.9317 1426.9067 1391.1628 1479.5062 1523.0792 
++        9        10        11        12        13        14        15        16 
++1460.0423 1316.4832 1366.9960 1423.5582  895.1120 1457.2705 1505.9501 1187.5165 
++       17        18        19        20 
++ 517.6920 1394.5162 1470.4671 1439.5571 
++> ## Significance test using Null model communities.
++> ## The current choice fixes numbers of species and picks species
++> ## proportionally to their overall frequency
++> oecosimu(dune, treedive, "r1", tree = cl, verbose = FALSE)
++Warning in oecosimu(dune, treedive, "r1", tree = cl, verbose = FALSE) :
++  nullmodel transformed 'comm' to binary data
++oecosimu object
++
++Call: oecosimu(comm = dune, nestfun = treedive, method = "r1", tree =
++cl, verbose = FALSE)
++
++nullmodel method ‘r1’ with 99 simulations
++
++alternative hypothesis: statistic is less or greater than simulated values
++
++   statistic      SES    mean    2.5%     50%  97.5% Pr(sim.)   
++1     384.09 -1.28273  781.41  382.13  664.87 1244.3     0.09 . 
++2     568.88 -2.29048 1245.21  648.63 1342.75 1602.9     0.01 **
++3    1172.95 -0.28386 1251.47  668.89 1353.45 1594.1     0.57   
++4    1327.93 -0.18989 1376.56  850.14 1462.61 1689.9     0.63   
++5    1426.91 -0.24932 1484.65  892.50 1544.84 1755.4     0.55   
++6    1391.16  0.40503 1285.89  721.15 1364.47 1596.7     0.83   
++7    1479.51  0.26497 1416.16  789.44 1480.89 1712.1     0.99   
++8    1523.08  0.56404 1366.20  742.42 1453.77 1730.5     0.63   
++9    1460.04  0.11145 1433.00  879.43 1498.68 1747.1     0.77   
++10   1316.48 -0.11917 1348.17  798.65 1428.77 1684.6     0.57   
++11   1367.00  0.73635 1164.21  630.76 1249.70 1516.6     0.51   
++12   1423.56  0.90574 1147.15  565.62 1260.84 1508.1     0.35   
++13    895.11 -1.04265 1207.29  628.21 1328.30 1580.5     0.51   
++14   1457.27  1.52076 1005.04  533.57 1133.14 1382.6     0.03 * 
++15   1505.95  1.34359 1109.43  504.18 1218.43 1511.6     0.07 . 
++16   1187.52  0.47862 1040.61  585.02 1175.42 1474.2     0.99   
++17    517.69 -1.44887  960.72  521.92 1120.30 1374.2     0.03 * 
++18   1394.52  0.88939 1138.12  652.91 1251.28 1505.1     0.39   
++19   1470.47  1.03008 1179.52  554.33 1275.38 1476.5     0.09 . 
++20   1439.56  1.22599 1085.02  553.27 1235.70 1441.9     0.09 . 
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> ## Phylogenetically ordered community table
++> dtree <- treedist(dune, cl)
++> tabasco(dune, hclust(dtree), cl)
++> ## Use tree distances  in capscale
++> capscale(dtree ~ 1, comm=dune)
++Call: capscale(formula = dtree ~ 1, comm = dune)
++
++              Inertia Eigenvals Rank
++Total          2.1834    2.3439     
++Unconstrained  2.1834    2.3439   10
++Imaginary               -0.1605    9
++Inertia is squared Treedist distance 
++
++Eigenvalues for unconstrained axes:
++  MDS1   MDS2   MDS3   MDS4   MDS5   MDS6   MDS7   MDS8   MDS9  MDS10 
++1.1971 0.4546 0.2967 0.1346 0.1067 0.0912 0.0391 0.0190 0.0045 0.0004 
++
++> 
++> 
++> 
++> cleanEx()
++> nameEx("tsallis")
++> ### * tsallis
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: tsallis
++> ### Title: Tsallis Diversity and Corresponding Accumulation Curves
++> ### Aliases: tsallis tsallisaccum persp.tsallisaccum
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(BCI)
++> i <- sample(nrow(BCI), 12)
++> x1 <- tsallis(BCI[i,])
++> x1
++     0      0.2      0.4       0.6      0.8        1      1.2      1.4      1.6
++14  97 43.58438 21.14034 11.153293 6.418569 4.017494 2.713442 1.956269 1.488283
++19 108 47.27018 22.32602 11.498387 6.492802 4.013094 2.692466 1.936696 1.473828
++28  84 38.19298 18.72155  9.985457 5.818617 3.693896 2.532394 1.852192 1.427230
++43  85 38.38228 18.77974 10.035449 5.867927 3.736254 2.565004 1.875593 1.443295
++10  93 41.50369 20.10059 10.639881 6.164157 3.889803 2.648176 1.922207 1.470121
++41 101 45.01956 21.66615 11.353495 6.499317 4.052495 2.729799 1.964435 1.492566
++42  86 39.74400 19.79375 10.684037 6.259100 3.966614 2.699614 1.954275 1.489483
++29  85 38.51838 18.81994 10.009321 5.819419 3.688721 2.526664 1.847408 1.423613
++27  98 43.84660 21.16041 11.110930 6.371476 3.980281 2.687154 1.938584 1.476662
++3   89 39.79074 19.34183 10.294475 6.003596 3.814060 2.612130 1.905004 1.461939
++9   89 39.96271 19.39982 10.272025 5.952153 3.761331 2.568371 1.872010 1.438318
++7   81 37.47840 18.73414 10.172688 6.004908 3.836811 2.631757 1.918091 1.469869
++        1.8         2
++14 1.182226 0.9718626
++19 1.172481 0.9655820
++28 1.145854 0.9499296
++43 1.156578 0.9569632
++10 1.172341 0.9663808
++41 1.184546 0.9731442
++42 1.183858 0.9731849
++29 1.143249 0.9481041
++27 1.174682 0.9669962
++3  1.168492 0.9646078
++9  1.152087 0.9534257
++7  1.173083 0.9672014
++> diversity(BCI[i,],"simpson") == x1[["2"]]
++  14   19   28   43   10   41   42   29   27    3    9    7 
++TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 
++> plot(x1)
++> x2 <- tsallis(BCI[i,],norm=TRUE)
++> x2
++   0       0.2       0.4       0.6       0.8         1       1.2       1.4
++14 1 0.9134203 0.8653450 0.8483542 0.8548076 0.8762317 0.9040571 0.9313075
++19 1 0.9079031 0.8537683 0.8315799 0.8347890 0.8554245 0.8846675 0.9147428
++28 1 0.8997942 0.8397547 0.8130733 0.8129096 0.8314621 0.8602754 0.8916927
++43 1 0.8955869 0.8360372 0.8125579 0.8165505 0.8387881 0.8699334 0.9021018
++10 1 0.9001004 0.8450759 0.8255446 0.8324355 0.8561634 0.8872568 0.9180261
++41 1 0.9130269 0.8644349 0.8473152 0.8541311 0.8762204 0.9047063 0.9323803
++42 1 0.9185764 0.8746393 0.8602787 0.8675785 0.8881987 0.9141183 0.9390681
++29 1 0.8987625 0.8378269 0.8104423 0.8098004 0.8281171 0.8569302 0.8885453
++27 1 0.9112896 0.8605499 0.8410587 0.8456725 0.8661975 0.8940909 0.9221774
++3  1 0.8943582 0.8362208 0.8155352 0.8226868 0.8476046 0.8803722 0.9129172
++9  1 0.8982235 0.8387276 0.8137568 0.8156375 0.8358867 0.8656242 0.8971059
++7  1 0.9094899 0.8600339 0.8427936 0.8492653 0.8706729 0.8985570 0.9261475
++         1.6       1.8         2
++14 0.9538903 0.9705576 0.9818818
++19 0.9406572 0.9605041 0.9745226
++28 0.9203563 0.9436787 0.9612382
++43 0.9302296 0.9522490 0.9682216
++10 0.9438798 0.9632975 0.9767719
++41 0.9550896 0.9716606 0.9827793
++42 0.9595063 0.9744477 0.9845010
++29 0.9175446 0.9412749 0.9592583
++27 0.9460502 0.9641597 0.9768635
++3  0.9403687 0.9610574 0.9754460
++9  0.9251745 0.9475646 0.9641383
++7  0.9493990 0.9669335 0.9791421
++> plot(x2)
++> mod1 <- tsallisaccum(BCI[i,])
++> plot(mod1, as.table=TRUE, col = c(1, 2, 2))
++> persp(mod1)
++> mod2 <- tsallisaccum(BCI[i,], norm=TRUE)
++> persp(mod2,theta=100,phi=30)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("varechem")
++> ### * varechem
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: varespec
++> ### Title: Vegetation and environment in lichen pastures
++> ### Aliases: varechem varespec
++> ### Keywords: datasets
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> data(varechem)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("varpart")
++> ### * varpart
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: varpart
++> ### Title: Partition the Variation of Community Matrix by 2, 3, or 4
++> ###   Explanatory Matrices
++> ### Aliases: varpart varpart2 varpart3 varpart4 showvarparts plot.varpart
++> ###   plot.varpart234 simpleRDA2 simpleDBRDA
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(mite)
++> data(mite.env)
++> data(mite.pcnm)
++> 
++> # Two explanatory matrices -- Hellinger-transform Y
++> # Formula shortcut "~ ." means: use all variables in 'data'.
++> mod <- varpart(mite, ~ ., mite.pcnm, data=mite.env, transfo="hel")
++> mod
++
++Partition of variance in RDA 
++
++Call: varpart(Y = mite, X = ~., mite.pcnm, data = mite.env, transfo =
++"hel")
++Species transformation:  hellinger
++Explanatory tables:
++X1:  ~.
++X2:  mite.pcnm 
++
++No. of explanatory tables: 2 
++Total variation (SS): 27.205 
++            Variance: 0.39428 
++No. of observations: 70 
++
++Partition table:
++                     Df R.squared Adj.R.squared Testable
++[a+b] = X1           11   0.52650       0.43670     TRUE
++[b+c] = X2           22   0.62300       0.44653     TRUE
++[a+b+c] = X1+X2      33   0.75893       0.53794     TRUE
++Individual fractions                                    
++[a] = X1|X2          11                 0.09141     TRUE
++[b]                   0                 0.34530    FALSE
++[c] = X2|X1          22                 0.10124     TRUE
++[d] = Residuals                         0.46206    FALSE
++---
++Use function ‘rda’ to test significance of fractions of interest
++> 
++> ## Use fill colours
++> showvarparts(2, bg = c("hotpink","skyblue"))
++> plot(mod, bg = c("hotpink","skyblue"))
++> # Alternative way of to conduct this partitioning
++> # Change the data frame with factors into numeric model matrix
++> mm <- model.matrix(~ SubsDens + WatrCont + Substrate + Shrub + Topo, mite.env)[,-1]
++> mod <- varpart(decostand(mite, "hel"), mm, mite.pcnm)
++> # Test fraction [a] using partial RDA:
++> aFrac <- rda(decostand(mite, "hel"), mm, mite.pcnm)
++> anova(aFrac, step=200, perm.max=200)
++Permutation test for rda under reduced model
++Permutation: free
++Number of permutations: 999
++
++Model: rda(X = decostand(mite, "hel"), Y = mm, Z = mite.pcnm)
++         Df Variance      F Pr(>F)    
++Model    11 0.053592 1.8453  0.001 ***
++Residual 36 0.095050                  
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> # RsquareAdj gives the same result as component [a] of varpart
++> RsquareAdj(aFrac)
++$r.squared
++[1] 0.1359251
++
++$adj.r.squared
++[1] 0.09140797
++
++> 
++> # Partition Bray-Curtis dissimilarities
++> varpart(vegdist(mite), ~ ., mite.pcnm, data = mite.env)
++
++Partition of squared Bray distance in dbRDA 
++
++Call: varpart(Y = vegdist(mite), X = ~., mite.pcnm, data = mite.env)
++
++Explanatory tables:
++X1:  ~.
++X2:  mite.pcnm 
++
++No. of explanatory tables: 2 
++Total variation (SS): 14.696 
++No. of observations: 70 
++
++Partition table:
++                     Df R.squared Adj.R.squared Testable
++[a+b] = X1           11   0.50512       0.41127     TRUE
++[b+c] = X2           22   0.60144       0.41489     TRUE
++[a+b+c] = X1+X2      33   0.74631       0.51375     TRUE
++Individual fractions                                    
++[a] = X1|X2          11                 0.09887     TRUE
++[b]                   0                 0.31240    FALSE
++[c] = X2|X1          22                 0.10249     TRUE
++[d] = Residuals                         0.48625    FALSE
++---
++Use function ‘capscale’ to test significance of fractions of interest
++> # Three explanatory matrices 
++> mod <- varpart(mite, ~ SubsDens + WatrCont, ~ Substrate + Shrub + Topo,
+++    mite.pcnm, data=mite.env, transfo="hel")
++> mod
++
++Partition of variance in RDA 
++
++Call: varpart(Y = mite, X = ~SubsDens + WatrCont, ~Substrate + Shrub +
++Topo, mite.pcnm, data = mite.env, transfo = "hel")
++Species transformation:  hellinger
++Explanatory tables:
++X1:  ~SubsDens + WatrCont
++X2:  ~Substrate + Shrub + Topo
++X3:  mite.pcnm 
++
++No. of explanatory tables: 3 
++Total variation (SS): 27.205 
++            Variance: 0.39428 
++No. of observations: 70 
++
++Partition table:
++                      Df R.square Adj.R.square Testable
++[a+d+f+g] = X1         2  0.32677      0.30667     TRUE
++[b+d+e+g] = X2         9  0.40395      0.31454     TRUE
++[c+e+f+g] = X3        22  0.62300      0.44653     TRUE
++[a+b+d+e+f+g] = X1+X2 11  0.52650      0.43670     TRUE
++[a+c+d+e+f+g] = X1+X3 24  0.67372      0.49970     TRUE
++[b+c+d+e+f+g] = X2+X3 31  0.72400      0.49884     TRUE
++[a+b+c+d+e+f+g] = All 33  0.75893      0.53794     TRUE
++Individual fractions                                   
++[a] = X1 | X2+X3       2               0.03910     TRUE
++[b] = X2 | X1+X3       9               0.03824     TRUE
++[c] = X3 | X1+X2      22               0.10124     TRUE
++[d]                    0               0.01407    FALSE
++[e]                    0               0.09179    FALSE
++[f]                    0               0.08306    FALSE
++[g]                    0               0.17045    FALSE
++[h] = Residuals                        0.46206    FALSE
++Controlling 1 table X                                  
++[a+d] = X1 | X3        2               0.05317     TRUE
++[a+f] = X1 | X2        2               0.12216     TRUE
++[b+d] = X2 | X3        9               0.05231     TRUE
++[b+e] = X2 | X1        9               0.13003     TRUE
++[c+e] = X3 | X1       22               0.19303     TRUE
++[c+f] = X3 | X2       22               0.18429     TRUE
++---
++Use function ‘rda’ to test significance of fractions of interest
++> showvarparts(3, bg=2:4)
++> plot(mod, bg=2:4)
++> # An alternative formulation of the previous model using
++> # matrices mm1 amd mm2 and Hellinger transformed species data
++> mm1 <- model.matrix(~ SubsDens + WatrCont, mite.env)[,-1]
++> mm2 <- model.matrix(~ Substrate + Shrub + Topo, mite.env)[, -1]
++> mite.hel <- decostand(mite, "hel")
++> mod <- varpart(mite.hel, mm1, mm2, mite.pcnm)
++> # Use RDA to test fraction [a]
++> # Matrix can be an argument in formula
++> rda.result <- rda(mite.hel ~ mm1 + Condition(mm2) +
+++    Condition(as.matrix(mite.pcnm)))
++> anova(rda.result, step=200, perm.max=200)
++Permutation test for rda under reduced model
++Permutation: free
++Number of permutations: 999
++
++Model: rda(formula = mite.hel ~ mm1 + Condition(mm2) + Condition(as.matrix(mite.pcnm)))
++         Df Variance      F Pr(>F)    
++Model     2 0.013771 2.6079  0.001 ***
++Residual 36 0.095050                  
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> 
++> # Four explanatory tables
++> mod <- varpart(mite, ~ SubsDens + WatrCont, ~Substrate + Shrub + Topo,
+++   mite.pcnm[,1:11], mite.pcnm[,12:22], data=mite.env, transfo="hel")
++> mod
++
++Partition of variance in RDA 
++
++Call: varpart(Y = mite, X = ~SubsDens + WatrCont, ~Substrate + Shrub +
++Topo, mite.pcnm[, 1:11], mite.pcnm[, 12:22], data = mite.env, transfo =
++"hel")
++Species transformation:  hellinger
++Explanatory tables:
++X1:  ~SubsDens + WatrCont
++X2:  ~Substrate + Shrub + Topo
++X3:  mite.pcnm[, 1:11]
++X4:  mite.pcnm[, 12:22] 
++
++No. of explanatory tables: 4 
++Total variation (SS): 27.205 
++            Variance: 0.39428 
++No. of observations: 70 
++
++Partition table:
++                            Df R.square Adj.R.square Testable
++[aeghklno] = X1              2  0.32677      0.30667     TRUE
++[befiklmo] = X2              9  0.40395      0.31454     TRUE
++[cfgjlmno] = X3             11  0.53231      0.44361     TRUE
++[dhijkmno] = X4             11  0.09069     -0.08176     TRUE
++[abefghiklmno] = X1+X2      11  0.52650      0.43670     TRUE
++[acefghjklmno] = X1+X3      13  0.59150      0.49667     TRUE
++[adeghijklmno] = X1+X4      13  0.40374      0.26533     TRUE
++[bcefgijklmno] = X2+X3      20  0.63650      0.48813     TRUE
++[bdefhijklmno] = X2+X4      20  0.53338      0.34292     TRUE
++[cdfghijklmno] = X3+X4      22  0.62300      0.44653     TRUE
++[abcefghijklmno] = X1+X2+X3 22  0.67947      0.52944     TRUE
++[abdefghijklmno] = X1+X2+X4 22  0.61553      0.43557     TRUE
++[acdefghijklmno] = X1+X3+X4 24  0.67372      0.49970     TRUE
++[bcdefghijklmno] = X2+X3+X4 31  0.72400      0.49884     TRUE
++[abcdefghijklmno] = All     33  0.75893      0.53794     TRUE
++Individual fractions                                         
++[a] = X1 | X2+X3+X4          2               0.03910     TRUE
++[b] = X2 | X1+X3+X4          9               0.03824     TRUE
++[c] = X3 | X1+X2+X4         11               0.10237     TRUE
++[d] = X4 | X1+X2+X3         11               0.00850     TRUE
++[e]                          0               0.01407    FALSE
++[f]                          0               0.13200    FALSE
++[g]                          0               0.05355    FALSE
++[h]                          0               0.00220    FALSE
++[i]                          0              -0.00547    FALSE
++[j]                          0              -0.00963    FALSE
++[k]                          0              -0.00231    FALSE
++[l]                          0               0.24037    FALSE
++[m]                          0              -0.03474    FALSE
++[n]                          0               0.02730    FALSE
++[o]                          0              -0.06761    FALSE
++[p] = Residuals              0               0.46206    FALSE
++Controlling 2 tables X                                       
++[ae] = X1 | X3+X4            2               0.05317     TRUE
++[ag] = X1 | X2+X4            2               0.09265     TRUE
++[ah] = X1 | X2+X3            2               0.04131     TRUE
++[be] = X2 | X3+X4            9               0.05231     TRUE
++[bf] = X2 | X1+X4            9               0.17024     TRUE
++[bi] = X2 | X1+X3            9               0.03277     TRUE
++[cf] = X3 | X1+X4           11               0.23437     TRUE
++[cg] = X3 | X2+X4           11               0.15592     TRUE
++[cj] = X3 | X1+X2           11               0.09274     TRUE
++[dh] = X4 | X2+X3           11               0.01071     TRUE
++[di] = X4 | X1+X3           11               0.00303     TRUE
++[dj] = X4 | X1+X2           11              -0.00113     TRUE
++Controlling 1 table X                                        
++[aghn] = X1 | X2             2               0.12216     TRUE
++[aehk] = X1 | X3             2               0.05306     TRUE
++[aegl] = X1 | X4             2               0.34709     TRUE
++[bfim] = X2 | X1             9               0.13003     TRUE
++[beik] = X2 | X3             9               0.04452     TRUE
++[befl] = X2 | X4             9               0.42468     TRUE
++[cfjm] = X3 | X1            11               0.19000     TRUE
++[cgjn] = X3 | X2            11               0.17359     TRUE
++[cfgl] = X3 | X4            11               0.52830     TRUE
++[dijm] = X4 | X1            11              -0.04134     TRUE
++[dhjn] = X4 | X2            11               0.02837     TRUE
++[dhik] = X4 | X3            11               0.00292     TRUE
++---
++Use function ‘rda’ to test significance of fractions of interest
++> plot(mod, bg=2:5)
++> # Show values for all partitions by putting 'cutoff' low enough:
++> plot(mod, cutoff = -Inf, cex = 0.7, bg=2:5)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("vegan-package")
++> ### * vegan-package
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: vegan-package
++> ### Title: Community Ecology Package: Ordination, Diversity and
++> ###   Dissimilarities
++> ### Aliases: vegan-package vegan
++> ### Keywords: package multivariate univar models spatial nonparametric
++> ###   htest regression
++> 
++> ### ** Examples
++> 
++> ### Example 1: Unconstrained ordination
++> ## NMDS
++> data(varespec)
++> data(varechem)
++> ord <- metaMDS(varespec)
++Square root transformation
++Wisconsin double standardization
++Run 0 stress 0.1843196 
++Run 1 stress 0.2455912 
++Run 2 stress 0.2169407 
++Run 3 stress 0.2313231 
++Run 4 stress 0.1974406 
++Run 5 stress 0.1858402 
++Run 6 stress 0.1948414 
++Run 7 stress 0.2265717 
++Run 8 stress 0.222507 
++Run 9 stress 0.2023215 
++Run 10 stress 0.2673177 
++Run 11 stress 0.1976151 
++Run 12 stress 0.1852397 
++Run 13 stress 0.2341085 
++Run 14 stress 0.1955867 
++Run 15 stress 0.2137409 
++Run 16 stress 0.2109638 
++Run 17 stress 0.1825658 
++... New best solution
++... Procrustes: rmse 0.04169825  max resid 0.1521436 
++Run 18 stress 0.1843197 
++Run 19 stress 0.2570119 
++Run 20 stress 0.3760596 
++*** No convergence -- monoMDS stopping criteria:
++    20: stress ratio > sratmax
++> plot(ord, type = "t")
++> ## Fit environmental variables
++> ef <- envfit(ord, varechem)
++> ef
++
++***VECTORS
++
++            NMDS1    NMDS2     r2 Pr(>r)    
++N        -0.05719 -0.99836 0.2537  0.039 *  
++P         0.61959  0.78492 0.1938  0.129    
++K         0.76629  0.64249 0.1809  0.138    
++Ca        0.68506  0.72849 0.4119  0.005 ** 
++Mg        0.63240  0.77464 0.4271  0.005 ** 
++S         0.19123  0.98155 0.1752  0.133    
++Al       -0.87169  0.49006 0.5269  0.001 ***
++Fe       -0.93613  0.35164 0.4451  0.001 ***
++Mn        0.79873 -0.60169 0.5230  0.002 ** 
++Zn        0.61750  0.78657 0.1879  0.122    
++Mo       -0.90304  0.42955 0.0609  0.524    
++Baresoil  0.92503 -0.37988 0.2508  0.043 *  
++Humdepth  0.93291 -0.36011 0.5200  0.001 ***
++pH       -0.64809  0.76156 0.2308  0.064 .  
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++Permutation: free
++Number of permutations: 999
++
++
++> plot(ef, p.max = 0.05)
++> ### Example 2: Constrained ordination (RDA)
++> ## The example uses formula interface to define the model
++> data(dune)
++> data(dune.env)
++> ## No constraints: PCA
++> mod0 <- rda(dune ~ 1, dune.env)
++> mod0
++Call: rda(formula = dune ~ 1, data = dune.env)
++
++              Inertia Rank
++Total           84.12     
++Unconstrained   84.12   19
++Inertia is variance 
++
++Eigenvalues for unconstrained axes:
++   PC1    PC2    PC3    PC4    PC5    PC6    PC7    PC8 
++24.795 18.147  7.629  7.153  5.695  4.333  3.199  2.782 
++(Showed only 8 of all 19 unconstrained eigenvalues)
++
++> plot(mod0)
++> ## All environmental variables: Full model
++> mod1 <- rda(dune ~ ., dune.env)
++> mod1
++Call: rda(formula = dune ~ A1 + Moisture + Management + Use + Manure,
++data = dune.env)
++
++              Inertia Proportion Rank
++Total         84.1237     1.0000     
++Constrained   63.2062     0.7513   12
++Unconstrained 20.9175     0.2487    7
++Inertia is variance 
++Some constraints were aliased because they were collinear (redundant)
++
++Eigenvalues for constrained axes:
++  RDA1   RDA2   RDA3   RDA4   RDA5   RDA6   RDA7   RDA8   RDA9  RDA10  RDA11 
++22.396 16.208  7.039  4.038  3.760  2.609  2.167  1.803  1.404  0.917  0.582 
++ RDA12 
++ 0.284 
++
++Eigenvalues for unconstrained axes:
++  PC1   PC2   PC3   PC4   PC5   PC6   PC7 
++6.627 4.309 3.549 2.546 2.340 0.934 0.612 
++
++> plot(mod1)
++> ## Automatic selection of variables by permutation P-values
++> mod <- ordistep(mod0, scope=formula(mod1))
++
++Start: dune ~ 1 
++
++             Df    AIC      F Pr(>F)   
+++ Management  3 87.082 2.8400  0.005 **
+++ Moisture    3 87.707 2.5883  0.005 **
+++ Manure      4 89.232 1.9539  0.015 * 
+++ A1          1 89.591 1.9217  0.045 * 
+++ Use         2 91.032 1.1741  0.295   
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++
++Step: dune ~ Management 
++
++             Df   AIC    F Pr(>F)   
++- Management  3 89.62 2.84  0.005 **
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++
++           Df    AIC      F Pr(>F)   
+++ Moisture  3 85.567 1.9764  0.010 **
+++ Manure    3 87.517 1.3902  0.045 * 
+++ A1        1 87.424 1.2965  0.245   
+++ Use       2 88.284 1.0510  0.400   
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++
++Step: dune ~ Management + Moisture 
++
++             Df    AIC      F Pr(>F)   
++- Moisture    3 87.082 1.9764  0.015 * 
++- Management  3 87.707 2.1769  0.005 **
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++
++         Df    AIC      F Pr(>F)
+++ Manure  3 85.762 1.1225  0.255
+++ A1      1 86.220 0.8359  0.625
+++ Use     2 86.842 0.8027  0.780
++
++> mod
++Call: rda(formula = dune ~ Management + Moisture, data = dune.env)
++
++              Inertia Proportion Rank
++Total         84.1237     1.0000     
++Constrained   46.4249     0.5519    6
++Unconstrained 37.6988     0.4481   13
++Inertia is variance 
++
++Eigenvalues for constrained axes:
++  RDA1   RDA2   RDA3   RDA4   RDA5   RDA6 
++21.588 14.075  4.123  3.163  2.369  1.107 
++
++Eigenvalues for unconstrained axes:
++  PC1   PC2   PC3   PC4   PC5   PC6   PC7   PC8   PC9  PC10  PC11  PC12  PC13 
++8.241 7.138 5.355 4.409 3.143 2.770 1.878 1.741 0.952 0.909 0.627 0.311 0.227 
++
++> plot(mod)
++> ## Permutation test for all variables
++> anova(mod)
++Permutation test for rda under reduced model
++Permutation: free
++Number of permutations: 999
++
++Model: rda(formula = dune ~ Management + Moisture, data = dune.env)
++         Df Variance      F Pr(>F)    
++Model     6   46.425 2.6682  0.001 ***
++Residual 13   37.699                  
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> ## Permutation test of "type III" effects, or significance when a term
++> ## is added to the model after all other terms
++> anova(mod, by = "margin")
++Permutation test for rda under reduced model
++Marginal effects of terms
++Permutation: free
++Number of permutations: 999
++
++Model: rda(formula = dune ~ Management + Moisture, data = dune.env)
++           Df Variance      F Pr(>F)   
++Management  3   18.938 2.1769  0.003 **
++Moisture    3   17.194 1.9764  0.005 **
++Residual   13   37.699                 
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> ## Plot only sample plots, use different symbols and draw SD ellipses 
++> ## for Managemenet classes
++> plot(mod, display = "sites", type = "n")
++> with(dune.env, points(mod, disp = "si", pch = as.numeric(Management)))
++> with(dune.env, legend("topleft", levels(Management), pch = 1:4,
+++   title = "Management"))
++> with(dune.env, ordiellipse(mod, Management, label = TRUE))
++> ## add fitted surface of diversity to the model
++> ordisurf(mod, diversity(dune), add = TRUE)
++
++Family: gaussian 
++Link function: identity 
++
++Formula:
++y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
++
++Estimated degrees of freedom:
++1.28  total = 2.28 
++
++REML score: 3.00623     
++> ### Example 3: analysis of dissimilarites a.k.a. non-parametric
++> ### permutational anova
++> adonis(dune ~ ., dune.env)
++
++Call:
++adonis(formula = dune ~ ., data = dune.env) 
++
++Permutation: free
++Number of permutations: 999
++
++Terms added sequentially (first to last)
++
++           Df SumsOfSqs MeanSqs F.Model      R2 Pr(>F)    
++A1          1    0.7230 0.72295  5.2038 0.16817  0.001 ***
++Moisture    3    1.1871 0.39569  2.8482 0.27613  0.006 ** 
++Management  3    0.9036 0.30121  2.1681 0.21019  0.023 *  
++Use         2    0.0921 0.04606  0.3315 0.02143  0.982    
++Manure      3    0.4208 0.14026  1.0096 0.09787  0.481    
++Residuals   7    0.9725 0.13893         0.22621           
++Total      19    4.2990                 1.00000           
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> adonis(dune ~ Management + Moisture, dune.env)
++
++Call:
++adonis(formula = dune ~ Management + Moisture, data = dune.env) 
++
++Permutation: free
++Number of permutations: 999
++
++Terms added sequentially (first to last)
++
++           Df SumsOfSqs MeanSqs F.Model      R2 Pr(>F)    
++Management  3    1.4686 0.48953  3.7907 0.34161  0.001 ***
++Moisture    3    1.1516 0.38387  2.9726 0.26788  0.002 ** 
++Residuals  13    1.6788 0.12914         0.39051           
++Total      19    4.2990                 1.00000           
++---
++Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
++> 
++> 
++> 
++> cleanEx()
++> nameEx("vegdist")
++> ### * vegdist
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Encoding: UTF-8
++> 
++> ### Name: vegdist
++> ### Title: Dissimilarity Indices for Community Ecologists
++> ### Aliases: vegdist
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> vare.dist <- vegdist(varespec)
++> # Orlóci's Chord distance: range 0 .. sqrt(2)
++> vare.dist <- vegdist(decostand(varespec, "norm"), "euclidean")
++> # Anderson et al.  (2006) version of Gower
++> vare.dist <- vegdist(decostand(varespec, "log"), "altGower")
++Warning: non-integer data: divided by smallest positive value
++> # Range standardization with "altGower" (that excludes double-zeros)
++> vare.dist <- vegdist(decostand(varespec, "range"), "altGower")
++> 
++> 
++> 
++> cleanEx()
++> nameEx("vegemite")
++> ### * vegemite
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: vegemite
++> ### Title: Display Compact Ordered Community Tables
++> ### Aliases: vegemite tabasco coverscale
++> ### Keywords: print manip hplot
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> ## Print only more common species 
++> freq <- apply(varespec > 0, 2, sum)
++> vegemite(varespec, scale="Hult", sp.ind = freq > 10)
++                                  
++          1122212121122       1112
++          854739268340575634292011
++ Callvulg 111...11.311...1111.111.
++ Empenigr 211332121112211111212213
++ Vaccviti 323332212113221211233234
++ Pinusylv 111.111111111.11.1111111
++ Dicrfusc 12.111441121211111111111
++ Dicrpoly .11.11.11..1.11....1.111
++ Pleuschr 144533435123411111111131
++ Polyjuni 111.11.111112111.111.111
++ Pohlnuta 111111111111.1..11.11111
++ Ptilcili 1111111111..1..11.11..12
++ Cladarbu 321122121332143423111121
++ Cladrang 321221131312145443313241
++ Cladstel 11111311.211.11254555542
++ Cladunci 112111111131111111111111
++ Cladcocc 11..11111111111111.1.11.
++ Cladcorn 111111111111111111111111
++ Cladgrac 111111111111111111111.11
++ Cladfimb 11.1111111111111111111.1
++ Cladcris 111111111111111111111111
++ Cladchlo ..1.111..1...1.11.11.1.1
++ Cetreric 111...11.111111111.1.1..
++ Cetrisla .11....1111.1....1.11111
++ Stersp   111.11.1111.112111...11.
++ Claddefo 1111111111111111111111.1
++  sites species 
++     24      24 
++scale:  Hult 
++> ## Order by correspondence analysis, use Hill scaling and layout:
++> dca <- decorana(varespec)
++> vegemite(varespec, dca, "Hill", zero="-")
++                                  
++           1   1  1 11122211122222
++          203942561738913046572458
++ Flavniva -1114-11-1-11-1---------
++ Cladstel 5555551451425411111211--
++ Cladphyl -1-1----1-------1-------
++ Cladcerv 1---1-----------------1-
++ Cladsp   ---11--1--11---1-1-11-1-
++ Cladamau --1---1----1------------
++ Cladchlo 1111---1-11-111-----11--
++ Cladrang 535254555555223414332321
++ Diphcomp --11-----112----------1-
++ Stersp   -11-1-4111111-1-111--111
++ Pinusylv 11-111111-111111111-1111
++ Polypili ------111--11-11--1-----
++ Cetrisla -1-111--1-1--1--111--111
++ Cladcocc -1111-1111111-11111-1-11
++ Cladarbu 113142453555313343413231
++ Vacculig --1-1----3-1---1---12-11
++ Pohlnuta -11111--11111111111111-1
++ Cladfimb 11111111-111111111111-11
++ Callvulg 111-21-12-51---1221-21--
++ Icmaeric ------1--1------11------
++ Empenigr 342214131314344333143131
++ Vaccviti 342514244334455432444443
++ Cladgrac 1-1111111111111111111111
++ Cetreric -1111-11-111---1111-111-
++ Cladcorn 111111111111111111111111
++ Cladcris 111111111111111111111111
++ Peltapht --------1-11--1----1--1-
++ Ptilcili 1-11---11-11141--1111111
++ Barbhatc ----------1-121----1----
++ Claddefo 11111111-111111111111111
++ Cladbotr ----------1-1111---1-1-1
++ Betupube -------------1------1-1-
++ Dicrpoly -1-1--1-11--1211-11--1-1
++ Cladunci 111111122111111251212311
++ Polycomm ------------11--1--1--1-
++ Polyjuni 11-11-1111111121111--131
++ Rhodtome ----------1--2-----21--1
++ Dicrfusc 111111111121112145425-41
++ Pleuschr 111213114132524434555555
++ Vaccmyrt ---1------1-24--12133--4
++ Descflex ----1----1--11-----21-11
++ Nepharct --1------1-1---1------2-
++ Dicrsp   -----1----1--1-1-11-1541
++ Hylosple ---------------1---3--13
++  sites species 
++     24      44 
++scale:  Hill 
++> ## Show one class from cluster analysis, but retain the ordering above
++> clus <- hclust(vegdist(varespec))
++> cl <- cutree(clus, 3)
++> sel <- vegemite(varespec, use=dca, select = cl == 3, scale="Br")
++               
++           1 12
++          20921
++ Flavniva .++..
++ Cladstel 55542
++ Cladphyl .++..
++ Cladcerv r....
++ Cladsp   ..+..
++ Cladchlo r++.+
++ Cladrang 22121
++ Diphcomp ..+..
++ Stersp   .+...
++ Pinusylv r++1+
++ Cetrisla .++++
++ Cladcocc .++..
++ Cladarbu +1+1+
++ Pohlnuta .++++
++ Cladfimb r++++
++ Callvulg r+.+.
++ Empenigr 22122
++ Vaccviti 22223
++ Cladgrac r.+++
++ Cetreric .++..
++ Cladcorn r+++r
++ Cladcris r++++
++ Ptilcili r.+.2
++ Barbhatc ....1
++ Claddefo r++++
++ Cladbotr ....+
++ Betupube ....+
++ Dicrpoly .++.1
++ Cladunci +++1+
++ Polycomm ....+
++ Polyjuni r++.+
++ Rhodtome ....1
++ Dicrfusc r++++
++ Pleuschr ++121
++ Vaccmyrt ..+.2
++ Descflex ....+
++ Dicrsp   ...++
++  sites species 
++      5      37 
++scale:  Braun.Blanquet 
++> ## Re-create previous
++> vegemite(varespec, sp=sel$sp, site=sel$site, scale="Hult")
++               
++           1 12
++          20921
++ Flavniva .11..
++ Cladstel 55552
++ Cladphyl .11..
++ Cladcerv 1....
++ Cladsp   ..1..
++ Cladchlo 111.1
++ Cladrang 32131
++ Diphcomp ..1..
++ Stersp   .1...
++ Pinusylv 11111
++ Cetrisla .1111
++ Cladcocc .11..
++ Cladarbu 11111
++ Pohlnuta .1111
++ Cladfimb 11111
++ Callvulg 11.1.
++ Empenigr 22123
++ Vaccviti 22334
++ Cladgrac 1.111
++ Cetreric .11..
++ Cladcorn 11111
++ Cladcris 11111
++ Ptilcili 1.1.2
++ Barbhatc ....1
++ Claddefo 11111
++ Cladbotr ....1
++ Betupube ....1
++ Dicrpoly .11.1
++ Cladunci 11111
++ Polycomm ....1
++ Polyjuni 111.1
++ Rhodtome ....1
++ Dicrfusc 11111
++ Pleuschr 11111
++ Vaccmyrt ..1.3
++ Descflex ....1
++ Dicrsp   ...11
++  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
++ Flavniva 21.111.111....11........
++ Cladamau .1.1...1................
++ Stersp   111211111....111.1.111.1
++ Polypili ..111..1......111..1....
++ Diphcomp .1...111.1...........1..
++ Cladphyl ..1.....11...1..........
++ Cladrang 344544332133111223121121
++ Cladcerv 1.........1..........1..
++ Cladstel 454121215555213111111.1.
++ Cladarbu 322344331111132222121111
++ Vacculig 11...2.1........1.1..111
++ Callvulg 111.1.311.11.1..11111...
++ Icmaeric ...1.1.......1...1......
++ Cladsp   1...1.11.1......111..11.
++ Cladcocc 1111111111...1111111.1.1
++ Pinusylv 1.111.1111111111111111.1
++ Cladchlo .1..111.111.1.11..1.1...
++ Cetrisla 1.1...1.11.111...1.111.1
++ Cladfimb 11.11111111111111111.111
++ Peltapht ..1...11.......1.....11.
++ Cetreric 11.1111111...1..111111..
++ Cladgrac 11111111.111111111111111
++ Pohlnuta 111..11111.1111111111.11
++ Ptilcili .11.1.11.11.2.11.1111111
++ Barbhatc ......1.....1.11......1.
++ Cladcorn 111111111111111111111111
++ Vaccviti 113122132323412331223232
++ Cladcris 111111111111111111111111
++ Empenigr 111111122122312322111231
++ Cladbotr ......1.....1.111...1.11
++ Betupube ............1.....1..1..
++ Cladunci 111111111111131111112111
++ Claddefo 11.111111111111111111111
++ Dicrpoly ..11.1..11..1.1111.11..1
++ Polycomm ............111......11.
++ Rhodtome ......1.....1.....1...11
++ Polyjuni 1.111111111.111111.112.1
++ Dicrfusc 11111111111112111442.211
++ Pleuschr 113111111111123333444455
++ Vaccmyrt ......1..1..311..111..13
++ Nepharct .1...1.1........1....1..
++ Dicrsp   ......1....11...111133.1
++ Descflex 1....1......1.1...1..111
++ Hylosple ................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"), dca)
++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)
++> 
++> 
++> 
++> cleanEx()
++> nameEx("wascores")
++> ### * wascores
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: wascores
++> ### Title: Weighted Averages Scores for Species
++> ### Aliases: wascores eigengrad
++> ### Keywords: multivariate univar
++> 
++> ### ** Examples
++> 
++> data(varespec)
++> data(varechem)
++> vare.dist <- vegdist(wisconsin(varespec))
++> vare.mds <- monoMDS(vare.dist)
++> vare.points <- postMDS(vare.mds$points, vare.dist)
++> vare.wa <- wascores(vare.points, varespec)
++> plot(scores(vare.points), pch="+", asp=1)
++> text(vare.wa, rownames(vare.wa), cex=0.8, col="blue")
++> ## Omit rare species (frequency <= 4)
++> freq <- apply(varespec>0, 2, sum)
++> plot(scores(vare.points), pch="+", asp=1)
++> text(vare.wa[freq > 4,], rownames(vare.wa)[freq > 4],cex=0.8,col="blue")
++> ## Works for environmental variables, too.
++> wascores(varechem, varespec)
++                N        P         K       Ca        Mg        S        Al
++Callvulg 25.12401 41.66188 246.92383 572.3431  99.40828 49.10552 245.15751
++Empenigr 21.61371 44.17350 158.92517 580.8403  89.20628 35.75327 107.05670
++Rhodtome 22.34553 40.35530 162.31108 643.8819  95.07712 30.84303  28.83159
++Vaccmyrt 24.96352 49.80649 189.70177 656.4179  96.75529 34.55190  32.75705
++Vaccviti 21.14028 45.86984 162.12372 613.2126  94.30084 37.26975 116.14656
++Pinusylv 18.37299 44.24818 163.60195 670.9387  93.52214 37.02238 150.45523
++Descflex 22.24089 54.74804 212.20357 771.0159 114.15179 38.00000  24.64143
++Betupube 21.51034 28.86552 112.28276 513.5586  75.15172 23.55172  33.12414
++Vacculig 28.00729 33.48758 114.90230 372.9653  70.89954 29.32378 202.89008
++Diphcomp 22.34228 39.71049 127.44259 446.1565  80.16173 32.32963 122.31574
++Dicrsp   21.33007 60.03758 185.04563 828.0544 148.67509 46.75427  90.42294
++Dicrfusc 23.45681 39.14575 162.91954 578.2309  77.81648 33.48086  60.66890
++Dicrpoly 20.65446 43.87409 150.51485 665.5845 115.22112 36.17079  90.16733
++Hylosple 26.10599 67.88980 245.78681 779.6520 111.96685 42.27433  24.92738
++Pleuschr 22.60476 54.22534 199.96241 712.6278 109.23425 40.01132  70.43900
++Polypili 23.17377 43.75902 144.82623 724.9738  85.42623 30.58525 145.73115
++Polyjuni 22.89480 47.98022 154.81906 643.3864  87.27819 33.63863  53.24888
++Polycomm 21.73521 41.17042 154.91549 631.8704 101.84789 32.17324  46.80986
++Pohlnuta 19.99885 48.59198 169.68855 678.3813 104.31641 39.94427 132.05458
++Ptilcili 21.27880 33.44211 127.08522 564.5652  85.96417 27.11720  56.60692
++Barbhatc 21.17461 27.93323 113.13542 497.9138  77.50564 23.72288  42.09749
++Cladarbu 23.56127 38.04952 142.03073 454.9019  74.00779 33.81002 173.12698
++Cladrang 24.28421 38.60534 135.31177 463.2750  70.54209 32.53349 183.79979
++Cladstel 19.28049 46.71060 158.00576 540.4904  80.19153 40.29106 225.89526
++Cladunci 21.41240 45.49844 163.40402 621.9100  98.35538 40.00734 119.59481
++Cladcocc 21.72473 42.80681 156.32330 557.9007  80.95448 36.25161 149.82616
++Cladcorn 22.11640 47.06656 160.36881 623.5185  95.17781 36.75273 104.71463
++Cladgrac 22.51887 44.06576 156.50214 583.1558  94.10292 36.93930 134.13424
++Cladfimb 21.77980 41.82652 153.29444 512.4646  78.28232 35.62323 128.96061
++Cladcris 20.88795 44.12262 171.04016 574.5672  92.52169 38.24003 116.03507
++Cladchlo 19.51207 45.39655 150.93190 571.0233  95.77586 39.50862 156.81983
++Cladbotr 22.97660 38.89574 167.20000 590.8021  99.57234 34.79362  87.75957
++Cladamau 25.07143 35.84286 105.07857 395.2214  68.18571 27.11429  95.91429
++Cladsp   19.21923 47.37308 168.49231 526.7654  79.54423 45.15385 215.33846
++Cetreric 21.00944 47.76972 165.07972 579.6322  99.14944 42.25472 163.46000
++Cetrisla 18.36552 42.73695 151.78374 626.2813  89.77833 35.33498 132.68227
++Flavniva 18.56110 61.18194 207.67705 502.9203  60.91755 50.22532 396.82405
++Nepharct 23.33099 49.10019 146.84715 618.1601  64.27319 29.95760  31.72300
++Stersp   28.19743 32.84800  94.33459 389.5143  53.25377 24.22175  95.39326
++Peltapht 21.08553 54.45395 193.38816 886.5487 119.35132 37.92500 106.16447
++Icmaeric 28.88636 27.00000  87.86818 307.0500  40.48182 22.17273  89.94091
++Cladcerv 20.25000 56.79000 192.36000 519.2300  62.10000 45.18000 314.92000
++Claddefo 22.19198 45.22981 167.73069 583.7983  92.01320 38.51369 100.46139
++Cladphyl 15.73750 54.56875 180.39375 775.4500  99.65625 43.35000 208.55000
++                 Fe        Mn        Zn        Mo  Baresoil Humdepth       pH
++Callvulg  75.457843  52.38247  8.281074 0.4734635 27.241036 2.187819 2.845108
++Empenigr  38.146102  53.49357  7.159938 0.3289657 27.324317 2.367439 2.888078
++Rhodtome   5.560906  70.48260  7.444100 0.2251490 37.325030 2.689154 2.895352
++Vaccmyrt   5.589213  75.17221  7.838533 0.2666732 31.404171 2.798935 2.855216
++Vaccviti  37.586067  51.81515  7.617213 0.3680289 26.307701 2.307879 2.923128
++Pinusylv  39.121898  35.22311  7.733333 0.3485401 17.762968 1.996350 3.049148
++Descflex   6.066429 110.87232  9.526607 0.2316071 22.740179 2.834821 2.822857
++Betupube   5.417241  37.53448  5.637931 0.2068966 51.496552 2.527586 2.979310
++Vacculig  93.963929  37.73062  4.593824 0.3780552 21.410710 2.041196 3.006965
++Diphcomp  73.281173  46.88025  4.593827 0.3725309 31.836574 2.103704 2.856790
++Dicrsp    22.504617  65.35020 13.060765 0.5610370 23.182889 2.232247 2.954272
++Dicrfusc  13.922252  61.40958  6.922859 0.3218816 26.918674 2.484399 2.806431
++Dicrpoly  20.973927  33.28779  9.110561 0.3892739 37.304043 2.228713 3.015842
++Hylosple   4.729157 115.14606  9.885976 0.2851996 20.956264 2.925000 2.807594
++Pleuschr  19.113811  77.12277  9.007860 0.3405945 24.584979 2.596881 2.858446
++Polypili  51.993443  36.74754  8.045902 0.2204918 17.368852 1.493443 3.227869
++Polyjuni  12.885704  82.56274  7.945126 0.2760289 28.116303 2.615523 2.874729
++Polycomm   7.895775  68.22535  7.843662 0.2591549 38.687324 2.926761 2.860563
++Pohlnuta  33.089313  42.02290  8.452290 0.3935115 24.709351 2.147328 2.985496
++Ptilcili  14.036188  33.93547  5.906924 0.2303712 48.941884 2.502498 2.973376
++Barbhatc   8.199687  31.11379  5.550784 0.2084639 54.331975 2.514734 2.986834
++Cladarbu  65.470394  38.28429  6.387500 0.4464046 22.592997 2.048540 2.937879
++Cladrang  76.612752  34.86010  6.616452 0.3903501 17.270158 1.799128 3.022346
++Cladstel  84.639467  33.27903  7.287216 0.4054879  9.854042 1.851973 3.052167
++Cladunci  27.463504  40.10322  9.108102 0.5120114 28.312376 2.362687 2.858564
++Cladcocc  46.653763  43.53584  7.269176 0.3698925 19.972222 2.025090 2.974194
++Cladcorn  32.916238  53.38441  7.518489 0.3639871 26.620868 2.399518 2.890997
++Cladgrac  45.758366  44.63911  7.702724 0.4244163 25.546654 2.230350 2.933658
++Cladfimb  41.710354  47.83687  6.815152 0.3887626 24.763889 2.239394 2.902778
++Cladcris  34.729585  44.75984  6.933735 0.3746988 29.711352 2.400000 2.841633
++Cladchlo  42.089655  35.13276  7.908621 0.3814655 22.319655 2.075000 3.022414
++Cladbotr  23.374468  46.54255  7.263830 0.3106383 45.725532 2.580851 2.904255
++Cladamau  68.971429  41.98571  4.928571 0.3214286 27.592857 1.857143 2.914286
++Cladsp    47.913462  49.61923  8.421154 0.6173077 16.864423 2.213462 2.921154
++Cetreric  42.614167  36.96694  9.516389 0.5687500 21.452639 2.058056 2.923889
++Cetrisla  29.617734  33.24138  7.518227 0.3192118 26.417980 2.027586 3.065025
++Flavniva  94.339916  37.03232  9.116371 0.9987764 19.692312 1.799241 2.923629
++Nepharct  12.910837 115.15684  7.743536 0.2180608 23.135932 2.541065 2.918251
++Stersp    30.226998  31.97061  7.635502 0.2828767 15.844007 1.477740 3.038756
++Peltapht  37.598684  56.64079  7.652632 0.2046053 28.321053 2.286842 3.026316
++Icmaeric  24.236364  23.95909  6.618182 0.2863636 18.727273 1.568182 2.968182
++Cladcerv 111.090000  52.04000  8.530000 0.6800000 15.393000 1.870000 2.900000
++Claddefo  25.116325  48.81105  7.599609 0.4096285 33.814545 2.468133 2.823656
++Cladphyl  50.475000  35.28125  8.568750 0.2812500  7.728125 1.575000 3.231250
++> ## And the strengths of these variables are:
++> eigengrad(varechem, varespec)
++         N          P          K         Ca         Mg          S         Al 
++0.13000842 0.18880078 0.16246365 0.15722067 0.16359171 0.13391967 0.29817406 
++        Fe         Mn         Zn         Mo   Baresoil   Humdepth         pH 
++0.20766831 0.27254480 0.16783834 0.09542514 0.20931501 0.25051326 0.14583161 
++> 
++> 
++> 
++> cleanEx()
++> nameEx("wcmdscale")
++> ### * wcmdscale
++> 
++> flush(stderr()); flush(stdout())
++> 
++> ### Name: wcmdscale
++> ### Title: Weighted Classical (Metric) Multidimensional Scaling
++> ### Aliases: wcmdscale scores.wcmdscale plot.wcmdscale
++> ### Keywords: multivariate
++> 
++> ### ** Examples
++> 
++> ## Correspondence analysis as a weighted principal coordinates
++> ## analysis of Euclidean distances of Chi-square transformed data
++> data(dune)
++> rs <- rowSums(dune)/sum(dune)
++> d <- dist(decostand(dune, "chi"))
++> ord <- wcmdscale(d, w = rs, eig = TRUE)
++> ## Ordinary CA
++> ca <- cca(dune)
++> ## Eigevalues are numerically similar
++> ca$CA$eig - ord$eig
++          CA1           CA2           CA3           CA4           CA5 
++ 2.220446e-16 -1.276756e-15 -1.054712e-15  1.942890e-16  1.387779e-16 
++          CA6           CA7           CA8           CA9          CA10 
++ 1.387779e-16 -1.387779e-17 -1.387779e-16  2.359224e-16  2.775558e-17 
++         CA11          CA12          CA13          CA14          CA15 
++ 1.387779e-16  0.000000e+00  3.469447e-17  2.775558e-17  1.561251e-17 
++         CA16          CA17          CA18          CA19 
++ 0.000000e+00  1.734723e-18  1.127570e-17  1.196959e-16 
++> ## Configurations are similar when site scores are scaled by
++> ## eigenvalues in CA
++> procrustes(ord, ca, choices=1:19, scaling = "sites")
++
++Call:
++procrustes(X = ord, Y = ca, choices = 1:19, scaling = "sites") 
++
++Procrustes sum of squares:
++-4.263e-14 
++
++> plot(procrustes(ord, ca, choices=1:2, scaling="sites"))
++> ## Reconstruction of non-Euclidean distances with negative eigenvalues
++> d <- vegdist(dune)
++> ord <- wcmdscale(d, eig = TRUE)
++> ## Only positive eigenvalues:
++> cor(d, dist(ord$points))
++[1] 0.9975185
++> ## Correction with negative eigenvalues:
++> cor(d, sqrt(dist(ord$points)^2 - dist(ord$negaxes)^2))
++[1] 1
++> 
++> 
++> 
++> ### * <FOOTER>
++> ###
++> options(digits = 7L)
++> base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
++Time elapsed:  129.459 0.488 130.001 0 0 
++> grDevices::dev.off()
++null device 
++          1 
++> ###
++> ### Local variables: ***
++> ### mode: outline-minor ***
++> ### outline-regexp: "\\(> \\)?### [*]+" ***
++> ### End: ***
++> quit('no')
+diff --git a/tests/oecosimu-tests.R b/tests/oecosimu-tests.R
+new file mode 100644
+index 0000000..0e8a82b
+--- /dev/null
++++ b/tests/oecosimu-tests.R
+@@ -0,0 +1,166 @@
++### oecosimu-tests: unit tests for vegan functions
++
++### This file contains unit tests for oecosimu, permatfull and related
++### functions. This file is run in R CMD check and its results are
++### compared against previously saved results in
++### oecosimu-tests.Rout.save. If you change tests, you must generate
++### new oecosimu-tests.Rout.save in this directory.
++
++### The current plan is that tests/ are not included in the CRAN
++### release, but only in the development version of vegan in R-Forge.
++
++### The tests here are not intended for human reading. The tests need
++### not be ecological or biologically meaningful, but they are only
++### intended for testing strange arguments, protect against
++### regressions and test correctness of results.
++
++### The tests are in a single file and you should clean work space
++### after the unit test. You should set random number seed (if needed)
++### for comparison against vegan-tests.Rout.save, and you should
++### remove the seed after the unit test. If possible, avoid very long
++### lasting tests.
++
++### <-- oecosimu/permat specifics -->
++
++### The necessary condition is that fill, row and column sums are honoured. Secondarily we want to keep the simulation results identical when chaning the underlying routines in oecosimu (except experimental method = "backtrack"). The permatfull/swap code can be regarded as more experimental, and we can perhaps there change the simulation results, but not lightly. 
++
++###<--- BEGIN TESTS --->
++suppressPackageStartupMessages(require(vegan))
++set.seed(4711)
++
++### Prior to vegan 2.2-0 these were commsimulator() tests for binary
++### null model, but now commsimulator() is deprecated and calls were
++### replaced with corresponding simulate(nullmodel())
++
++## expect fill, rowSums, colSums
++expect <- data.frame("r00" = c(TRUE, FALSE, FALSE),
++                     "r0" = c(TRUE, TRUE, FALSE),
++                     "r1" = c(TRUE, TRUE, FALSE),
++                     "r2" = c(TRUE, TRUE, FALSE),
++                     "c0" = c(TRUE, FALSE, TRUE),
++                     "swap" = c(TRUE, TRUE, TRUE),
++                     "tswap" = c(TRUE, TRUE, TRUE),
++                     "quasiswap" = c(TRUE, TRUE, TRUE))
++margintest <- function(x, fill, rs, cs) {
++    c(sum(x) == fill,
++      all(rowSums(x) == rs),
++      all(colSums(x) == cs))
++}
++
++## data must be binary! 'sipoo' is (and not transformed) 
++data(sipoo)
++fill <- sum(sipoo)
++rs <- rowSums(sipoo)
++cs <- colSums(sipoo)
++
++for(method in names(expect)) {
++    m <- simulate(nullmodel(sipoo, method = method), thin = 100)
++    cat("--> method:", method, "\n")
++    cat("** margintest:")
++    print(all(margintest(m, fill, rs, cs) == expect[, method]))
++    vegemite(drop(m)) 
++}
++## clean
++rm(list = ls())
++
++### end commsimulator
++
++### set up permatfull/swap tests
++
++data(mite)
++data(mite.env)
++x <- as.matrix(subset(mite, mite.env$Topo == "Blanket"))
++x <- x[, colSums(x) > 0]
++gsum <- sum(x)
++rsum <- rowSums(x)
++csum <- colSums(x)
++fill <- sum(x>0)
++rfrq <- rowSums(x>0)
++cfrq <- colSums(x>0)
++
++margintest <-
++    function(x, gsum, rsum, csum, fill, rfrq, cfrq)
++{
++    cat("grand sum: ")
++    print(all.equal(sum(x), gsum, check.attributes = FALSE))
++    cat("row sums:  ")
++    print(all.equal(rowSums(x), rsum, check.attributes = FALSE))
++    cat("col sums:  ")
++    print(all.equal(colSums(x), csum, check.attributes = FALSE))
++    cat("fill:      ")
++    print(all.equal(sum(x>0), fill, check.attributes = FALSE))
++    cat("row freqs: ")
++    print(all.equal(rowSums(x>0), rfrq, check.attributes = FALSE))
++    cat("col freqs: ")
++    print(all.equal(colSums(x>0), cfrq, check.attributes = FALSE))
++}
++
++### permatfull
++
++set.seed(4711)
++margin <- c("none", "rows", "columns", "both")
++shuffle <- c("ind", "samp", "both")
++
++for(mar in margin) {
++    for(what in shuffle) {
++        cat("\n--> margin", mar, " shuffle", what, "<--\n")
++        set.seed(4711)
++        m <- permatfull(x, fixedmar = mar, shuffle = what, mtype = "count", 
++            times=1)$perm[[1]]
++        margintest(m, gsum, rsum, csum, fill, rfrq, cfrq)
++        print(m[,1:12])
++    }
++}
++
++### permatswap
++set.seed(4711)
++methods <- c("swap", "quasiswap", "swsh", "abuswap")
++margins <- c("rows", "columns", "both")
++shuffle <- c("samp", "both")
++
++incompatible <- function(method, margin)
++{
++    (method == "swap" && margin != "both") ||
++    (method == "abuswap" && margin == "both") ||
++    (method == "quasiswap" && margin != "both") ||
++    (method == "swsh" && margin == "both")
++}
++
++for(method in methods) {
++    for(margin in margins) {
++        for(what in shuffle) {
++            if (incompatible(method = method, margin = margin))
++                next
++            cat("\n*** ", method, " ***\n")
++            cat("--> margin", margin, " shuffle", what, "<--\n")
++            set.seed(4711)
++            m <- permatswap(x, method = method, fixedmar = margin, shuffle = what,
++                             mtype = "count", thin=100, times=1)$perm[[1]]
++            margintest(m, gsum, rsum, csum,fill, rfrq, cfrq)
++            print(m[,1:12])
++        }
++    }
++}
++### end permatswap
++
++nm=nullmodel(m,"abuswap_c")
++sm<-simulate(nm,nsim=100,thin=100,burnin=100)
++
++### clean
++rm(list = ls())
++
++## end permatfull/swap
++
++## The following vegan functions depend on *oecosimu*: adipart
++## hiersimu multipart raupcrick. The following functions directly
++## depend on *commsimulator*: permatfull1 permatswap1.  All these have
++## derived and/or method functions. These should not be broken.
++
++## Do not break raupcrick:
++set.seed(4711)
++data(sipoo)
++as.numeric(raupcrick(sipoo, nsimul = 99))
++rm(list = ls())
++## end raupcrick
++
++
+diff --git a/tests/oecosimu-tests.Rout.save b/tests/oecosimu-tests.Rout.save
+new file mode 100644
+index 0000000..1827843
+--- /dev/null
++++ b/tests/oecosimu-tests.Rout.save
+@@ -0,0 +1,1982 @@
++
++R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
++Copyright (C) 2015 The R Foundation for Statistical Computing
++Platform: x86_64-apple-darwin13.4.0 (64-bit)
++
++R is free software and comes with ABSOLUTELY NO WARRANTY.
++You are welcome to redistribute it under certain conditions.
++Type 'license()' or 'licence()' for distribution details.
++
++R is a collaborative project with many contributors.
++Type 'contributors()' for more information and
++'citation()' on how to cite R or R packages in publications.
++
++Type 'demo()' for some demos, 'help()' for on-line help, or
++'help.start()' for an HTML browser interface to help.
++Type 'q()' to quit R.
++
++> ### oecosimu-tests: unit tests for vegan functions
++> 
++> ### This file contains unit tests for oecosimu, permatfull and related
++> ### functions. This file is run in R CMD check and its results are
++> ### compared against previously saved results in
++> ### oecosimu-tests.Rout.save. If you change tests, you must generate
++> ### new oecosimu-tests.Rout.save in this directory.
++> 
++> ### The current plan is that tests/ are not included in the CRAN
++> ### release, but only in the development version of vegan in R-Forge.
++> 
++> ### The tests here are not intended for human reading. The tests need
++> ### not be ecological or biologically meaningful, but they are only
++> ### intended for testing strange arguments, protect against
++> ### regressions and test correctness of results.
++> 
++> ### The tests are in a single file and you should clean work space
++> ### after the unit test. You should set random number seed (if needed)
++> ### for comparison against vegan-tests.Rout.save, and you should
++> ### remove the seed after the unit test. If possible, avoid very long
++> ### lasting tests.
++> 
++> ### <-- oecosimu/permat specifics -->
++> 
++> ### The necessary condition is that fill, row and column sums are honoured. Secondarily we want to keep the simulation results identical when chaning the underlying routines in oecosimu (except experimental method = "backtrack"). The permatfull/swap code can be regarded as more experimental, and we can perhaps there change the simulation results, but not lightly. 
++> 
++> ###<--- BEGIN TESTS --->
++> suppressPackageStartupMessages(require(vegan))
++> set.seed(4711)
++> 
++> ### Prior to vegan 2.2-0 these were commsimulator() tests for binary
++> ### null model, but now commsimulator() is deprecated and calls were
++> ### replaced with corresponding simulate(nullmodel())
++> 
++> ## expect fill, rowSums, colSums
++> expect <- data.frame("r00" = c(TRUE, FALSE, FALSE),
+++                      "r0" = c(TRUE, TRUE, FALSE),
+++                      "r1" = c(TRUE, TRUE, FALSE),
+++                      "r2" = c(TRUE, TRUE, FALSE),
+++                      "c0" = c(TRUE, FALSE, TRUE),
+++                      "swap" = c(TRUE, TRUE, TRUE),
+++                      "tswap" = c(TRUE, TRUE, TRUE),
+++                      "quasiswap" = c(TRUE, TRUE, TRUE))
++> margintest <- function(x, fill, rs, cs) {
+++     c(sum(x) == fill,
+++       all(rowSums(x) == rs),
+++       all(colSums(x) == cs))
+++ }
++> 
++> ## data must be binary! 'sipoo' is (and not transformed) 
++> data(sipoo)
++> fill <- sum(sipoo)
++> rs <- rowSums(sipoo)
++> cs <- colSums(sipoo)
++> 
++> for(method in names(expect)) {
+++     m <- simulate(nullmodel(sipoo, method = method), thin = 100)
+++     cat("--> method:", method, "\n")
+++     cat("** margintest:")
+++     print(all(margintest(m, fill, rs, cs) == expect[, method]))
+++     vegemite(drop(m)) 
+++ }
++--> method: r00 
++** margintest:[1] TRUE
++                             
++           SLLS  FS AGH  KMK 
++           v.e.TSl.Fsra Taua 
++           aHdHokafapanRrisu 
++           rohorakarlnsauvtn 
++           tgogvtarhalkgtoai 
++           hhlheashonnhslkhsO
++           oomodLkolddokaaesn
++           llelsealmeelanrvra
++           mmnmhdrmnttmrdiois
++ Pandhali  1...11........1..1
++ Falcsubb  ..1....1.1..1...1.
++ Tetrtetr  1.....1.......1..1
++ Scolrust  ...11.1...1..1.11.
++ Colupalu  1..........1.1...1
++ Cucucano  ...1.1.1.......1..
++ Apusapus  .........1..1.....
++ Picucanu  ..........1.11...1
++ Dryomart  1...1...........11
++ Jynxtorq  ..11..1...1....1..
++ Deliurbi  .....11.1.........
++ Hirurust  .1.......1.11.1.1.
++ Motaalba  .......1....11.1..
++ Anthtriv  1..1...111........
++ Trogtrog  ..1.1...1.....1..1
++ Prunmodu  .....1.1...1..1.11
++ Turdpila  .....1.1......1..1
++ Turdphil  .....1...1....1...
++ Turdmeru  .1....1..1....1...
++ Eritrube  1....1..111.......
++ Oenaoena  .11....1..........
++ Phoephoe  ....1..1....11....
++ Acroarun  ..........1.1....1
++ Acroscir  1...11.....1.....1
++ Hippicte  1....11...1.....1.
++ Sylvatri  ..........1....1..
++ Sylvbori  ..111111.....11.11
++ Sylvcurr  .1.....1..........
++ Sylvcomm  .1..........1.....
++ Phylsibi  .1..1.....1..1..1.
++ Phyltrocs 1.111.............
++ Phyltrocd ....1.1....1.1...1
++ Reguregu  ...1..111.....1..1
++ Muscstri  11.1........1.....
++ Ficehypo  ..1.11.11......111
++ Parumajo  .1....1.....1.....
++ Parucaer  .................1
++ Paruater  ...........1......
++ Parumont  ..1....111...1.1..
++ Cardchlo  ...1......111....1
++ Cardspin  .1..11.1..........
++ Pyrrpyrr  .........1...1...1
++ Loxicurv  .1.......1.1....1.
++ Frincoel  11....1.....11....
++ Sturvulg  .........1.11.1...
++ Orioorio  ......1.....1.....
++ Corvcora  .1...1.....1...1..
++ Garrglan  11................
++  sites species 
++     18      48 
++--> method: r0 
++** margintest:[1] TRUE
++                             
++           SLLS  FS AGH  KMK 
++           v.e.TSl.Fsra Taua 
++           aHdHokafapanRrisu 
++           rohorakarlnsauvtn 
++           tgogvtarhalkgtoai 
++           hhlheashonnhslkhsO
++           oomodLkolddokaaesn
++           llelsealmeelanrvra
++           mmnmhdrmnttmrdiois
++ Pandhali  .........1..1..1.1
++ Falcsubb  .1................
++ Tetrtetr  .......1....1....1
++ Scolrust  ............1.1..1
++ Colupalu  ..1....11.1.....11
++ Cucucano  .....1..1..1.1111.
++ Apusapus  .1..1.......1..111
++ Picucanu  ...........1..1.11
++ Dryomart  .....11......1..11
++ Jynxtorq  ............1.1..1
++ Deliurbi  .....1...1.1.1...1
++ Hirurust  ............1....1
++ Motaalba  ..........11.1...1
++ Anthtriv  ...1......1...1..1
++ Trogtrog  .......1.1..11.111
++ Prunmodu  .........11....1..
++ Turdpila  .......1.........1
++ Turdphil  ............1....1
++ Turdmeru  ....1..1....1...11
++ Turdilia  ..1.......1..1.11.
++ Oenaoena  .....1..1.1.....11
++ Phoephoe  .............11..1
++ Acroarun  .............1....
++ Acroscir  111.......1..11...
++ Hippicte  ...........1....1.
++ Sylvatri  .......1..1...1..1
++ Sylvbori  .........1.11..111
++ Sylvcurr  ......111.....1.11
++ Sylvcomm  ..1..............1
++ Phylsibi  .......1...1....11
++ Phyltrocs .........11...1111
++ Phyltrocd 11...1......1.1...
++ Reguregu  .......1.....1..1.
++ Muscstri  ....1......1....11
++ Ficehypo  .............11111
++ Parumajo  1.1......1..1...1.
++ Parucaer  ...............111
++ Paruater  1...1...1.....111.
++ Parumont  ..............1.1.
++ Cardchlo  ...1..........1111
++ Cardspin  ....1............1
++ Pyrrpyrr  ......1..11....111
++ Loxicurv  ..........1..1..1.
++ Frincoel  .............1..11
++ Sturvulg  .....1.1.......111
++ Orioorio  ......1...11....1.
++ Corvcoro  ........1......111
++ Corvcora  ....1.....11.1111.
++ Garrglan  ...............111
++  sites species 
++     18      49 
++--> method: r1 
++** margintest:[1] TRUE
++                             
++           SLLS  FS AGH  KMK 
++           v.e.TSl.Fsra Taua 
++           aHdHokafapanRrisu 
++           rohorakarlnsauvtn 
++           tgogvtarhalkgtoai 
++           hhlheashonnhslkhsO
++           oomodLkolddokaaesn
++           llelsealmeelanrvra
++           mmnmhdrmnttmrdiois
++ Falcsubb  .............1....
++ Tetrtetr  ....1.........1.1.
++ Scolrust  .............1.1.1
++ Colupalu  ................11
++ Apusapus  ..........1.1...11
++ Picucanu  ................1.
++ Dryomart  ................11
++ Deliurbi  .............11.11
++ Hirurust  .................1
++ Motaalba  .....111....1.1111
++ Anthtriv  ..1.............11
++ Trogtrog  ............1....1
++ Prunmodu  .......1...1....11
++ Turdpila  ...........1....1.
++ Turdphil  .....1.......1.111
++ Turdmeru  .....1.1.1.1.11111
++ Turdilia  ....1...1.111...11
++ Eritrube  ..........1.1..111
++ Oenaoena  1.1............1.1
++ Phoephoe  .......1..1.......
++ Acroarun  .................1
++ Acroscir  .....1.1..11....1.
++ Hippicte  ......1.1....1..1.
++ Sylvatri  ............1....1
++ Sylvbori  .1..........1.1111
++ Sylvcurr  ....1.1...1....1.1
++ Sylvcomm  .........1.....1.1
++ Phylsibi  .....1...11...11.1
++ Phyltrocs .........11.1.1111
++ Phyltrocd .............11.11
++ Reguregu  11.11..1...11.1.11
++ Muscstri  .............11111
++ Parumajo  11.....11.1111.111
++ Parucaer  .............1..11
++ Paruater  ........1.....1...
++ Parumont  ..........1......1
++ Cardchlo  .......1........1.
++ Cardspin  .....1..1111.11111
++ Pyrrpyrr  ................1.
++ Loxicurv  ..1...1..1....11..
++ Frincoel  .1111..111.1111111
++ Sturvulg  .........11..1..11
++ Orioorio  ..............1.1.
++ Corvcoro  1.1.1..1..11111111
++ Corvcora  .................1
++ Garrglan  .................1
++  sites species 
++     18      46 
++--> method: r2 
++** margintest:[1] TRUE
++                             
++           SLLS  FS AGH  KMK 
++           v.e.TSl.Fsra Taua 
++           aHdHokafapanRrisu 
++           rohorakarlnsauvtn 
++           tgogvtarhalkgtoai 
++           hhlheashonnhslkhsO
++           oomodLkolddokaaesn
++           llelsealmeelanrvra
++           mmnmhdrmnttmrdiois
++ Pandhali  ..........1.....11
++ Falcsubb  ...............1..
++ Tetrtetr  .................1
++ Scolrust  ................11
++ Cucucano  ................1.
++ Apusapus  ................11
++ Jynxtorq  ..............1..1
++ Deliurbi  .................1
++ Hirurust  ............111..1
++ Motaalba  1.1..1....1.111111
++ Anthtriv  .1.........11..111
++ Trogtrog  ..........1..11.11
++ Prunmodu  .........1..1...11
++ Turdpila  ..........1...1.11
++ Turdphil  1...1..1....1..111
++ Turdmeru  .11.1.11...1.11111
++ Turdilia  .....1....1.....11
++ Eritrube  .....11.11..1.1111
++ Oenaoena  ..1.......11....1.
++ Acroscir  .................1
++ Hippicte  .......1..........
++ Sylvbori  .......1.......111
++ Sylvcurr  .1.1.....1.1111111
++ Sylvcomm  .............1..11
++ Phylsibi  ..............1111
++ Phyltrocs 11..1..11111111111
++ Phyltrocd ...........1...111
++ Reguregu  ..1.11111111111111
++ Muscstri  ..........1.....11
++ Ficehypo  ................1.
++ Parumajo  .......11111111111
++ Parucaer  ...............1.1
++ Parumont  ................11
++ Cardchlo  .................1
++ Cardspin  ....1..1.111.11111
++ Loxicurv  .............1...1
++ Frincoel  1..111.1111.111111
++ Sturvulg  .......1.....11.11
++ Corvcoro  ..1..11.1.11111111
++ Garrglan  ................1.
++  sites species 
++     18      40 
++--> method: c0 
++** margintest:[1] TRUE
++                             
++           SLLS  FS AGH  KMK 
++           v.e.TSl.Fsra Taua 
++           aHdHokafapanRrisu 
++           rohorakarlnsauvtn 
++           tgogvtarhalkgtoai 
++           hhlheashonnhslkhsO
++           oomodLkolddokaaesn
++           llelsealmeelanrvra
++           mmnmhdrmnttmrdiois
++ Pandhali  ............1.....
++ Falcsubb  ..1...............
++ Tetrtetr  ........1...1.....
++ Scolrust  ...1....1.........
++ Colupalu  .1................
++ Cucucano  ........1.........
++ Apusapus  ....1.............
++ Picucanu  ............1.....
++ Dryomart  ...1..............
++ Jynxtorq  1.................
++ Deliurbi  ............1.1...
++ Hirurust  .1.......1..11....
++ Motaalba  1..1..11.11.11..11
++ Anthtriv  ....111....1......
++ Trogtrog  .........1..11....
++ Prunmodu  ..11..1...........
++ Turdpila  .....1.....1......
++ Turdphil  ..11....1....1...1
++ Turdmeru  11..1...1.1111111.
++ Turdilia  .1.1..111..1......
++ Eritrube  .1111.1.....1...1.
++ Oenaoena  1....11.....1.....
++ Phoephoe  ......1...........
++ Acroarun  ....1.............
++ Acroscir  1.......1.........
++ Hippicte  ..1........1......
++ Sylvatri  .1................
++ Sylvbori  ......11...1.....1
++ Sylvcurr  1...11.11...1111..
++ Sylvcomm  ...........11...1.
++ Phylsibi  ..1....1...1.....1
++ Phyltrocs .11.1.1.1111111..1
++ Phyltrocd 11.............1..
++ Reguregu  .1..1.111111.111.1
++ Muscstri  .1......1.1.......
++ Ficehypo  ...1......1.......
++ Parumajo  .1..11.1.111...11.
++ Parucaer  ....1....1........
++ Paruater  ............1.....
++ Parumont  .....1......1.....
++ Cardchlo  1.1...............
++ Cardspin  1.1111111...11.11.
++ Pyrrpyrr  .1................
++ Loxicurv  1.......1.........
++ Frincoel  111111111111111111
++ Sturvulg  ..........1...1..1
++ Orioorio  ....1.............
++ Corvcoro  .111111111.111.1.1
++ Corvcora  .....1............
++ Garrglan  ..1...............
++  sites species 
++     18      50 
++--> method: swap 
++** margintest:[1] TRUE
++                             
++           SLLS  FS AGH  KMK 
++           v.e.TSl.Fsra Taua 
++           aHdHokafapanRrisu 
++           rohorakarlnsauvtn 
++           tgogvtarhalkgtoai 
++           hhlheashonnhslkhsO
++           oomodLkolddokaaesn
++           llelsealmeelanrvra
++           mmnmhdrmnttmrdiois
++ Pandhali  ............1.....
++ Falcsubb  .......1..........
++ Tetrtetr  .............1...1
++ Scolrust  ............1...1.
++ Colupalu  .................1
++ Cucucano  ................1.
++ Apusapus  .................1
++ Picucanu  ...........1......
++ Dryomart  ...............1..
++ Jynxtorq  .............1....
++ Deliurbi  ................11
++ Hirurust  .........1.....111
++ Motaalba  1.1....1.11.1111.1
++ Anthtriv  ..........1...1.11
++ Trogtrog  .......1........11
++ Prunmodu  ..........1.....11
++ Turdpila  ................11
++ Turdphil  .............11111
++ Turdmeru  11....111..11.1111
++ Turdilia  ....11....1....111
++ Eritrube  ........1.1.1.1111
++ Oenaoena  ....1........1..11
++ Phoephoe  .............1....
++ Acroarun  .................1
++ Acroscir  ..............1.1.
++ Hippicte  ................11
++ Sylvatri  .................1
++ Sylvbori  ....11..........11
++ Sylvcurr  ..1.1..1.1...11111
++ Sylvcomm  .............1..11
++ Phylsibi  .............1111.
++ Phyltrocs 1....111.1111.1111
++ Phyltrocd .....1.........1.1
++ Reguregu  .1...1..1111111111
++ Muscstri  ..............1.11
++ Ficehypo  ......1..........1
++ Parumajo  .......11.111.1111
++ Parucaer  ............1...1.
++ Paruater  .............1....
++ Parumont  ..........11......
++ Cardchlo  ..........1.....1.
++ Cardspin  ..1....11111111111
++ Pyrrpyrr  ................1.
++ Loxicurv  ...............1.1
++ Frincoel  111111111111111111
++ Sturvulg  ..............1.11
++ Orioorio  .................1
++ Corvcoro  .1111..1.111111111
++ Corvcora  .................1
++ Garrglan  ...........1......
++  sites species 
++     18      50 
++--> method: tswap 
++** margintest:[1] TRUE
++                             
++           SLLS  FS AGH  KMK 
++           v.e.TSl.Fsra Taua 
++           aHdHokafapanRrisu 
++           rohorakarlnsauvtn 
++           tgogvtarhalkgtoai 
++           hhlheashonnhslkhsO
++           oomodLkolddokaaesn
++           llelsealmeelanrvra
++           mmnmhdrmnttmrdiois
++ Pandhali  .................1
++ Falcsubb  1.................
++ Tetrtetr  ................11
++ Scolrust  ......1..........1
++ Colupalu  .................1
++ Cucucano  ................1.
++ Apusapus  .............1....
++ Picucanu  .................1
++ Dryomart  ..............1...
++ Jynxtorq  .............1....
++ Deliurbi  ................11
++ Hirurust  .......1...1.1..1.
++ Motaalba  111.1..1..111...11
++ Anthtriv  ............1.11.1
++ Trogtrog  ...........1....11
++ Prunmodu  ...............111
++ Turdpila  ................11
++ Turdphil  ..........1..1.111
++ Turdmeru  .......11111111111
++ Turdilia  ............111111
++ Eritrube  ........1..11.1111
++ Oenaoena  ..1....1.....1..1.
++ Phoephoe  ..........1.......
++ Acroarun  .................1
++ Acroscir  ..........1.....1.
++ Hippicte  ................11
++ Sylvatri  .................1
++ Sylvbori  ............1..111
++ Sylvcurr  .....1.11.1.1.1111
++ Sylvcomm  .............11..1
++ Phylsibi  ..............1111
++ Phyltrocs ....111..111111111
++ Phyltrocd ..............1.11
++ Reguregu  .11.11....11111111
++ Muscstri  ..............1.11
++ Ficehypo  ...............11.
++ Parumajo  .1...1.1111...1.11
++ Parucaer  .......1..1.......
++ Paruater  .................1
++ Parumont  ...............1.1
++ Cardchlo  ...............11.
++ Cardspin  1.1.1..1..11111111
++ Pyrrpyrr  ................1.
++ Loxicurv  .........11.......
++ Frincoel  111111111111111111
++ Sturvulg  .........1...1..1.
++ Orioorio  .........1........
++ Corvcoro  ...1111111.1111111
++ Corvcora  .................1
++ Garrglan  .................1
++  sites species 
++     18      50 
++--> method: quasiswap 
++** margintest:[1] TRUE
++                             
++           SLLS  FS AGH  KMK 
++           v.e.TSl.Fsra Taua 
++           aHdHokafapanRrisu 
++           rohorakarlnsauvtn 
++           tgogvtarhalkgtoai 
++           hhlheashonnhslkhsO
++           oomodLkolddokaaesn
++           llelsealmeelanrvra
++           mmnmhdrmnttmrdiois
++ Pandhali  ...........1......
++ Falcsubb  .................1
++ Tetrtetr  ................11
++ Scolrust  .......1........1.
++ Colupalu  .................1
++ Cucucano  ................1.
++ Apusapus  .................1
++ Picucanu  ............1.....
++ Dryomart  ................1.
++ Jynxtorq  .................1
++ Deliurbi  ..........1....1..
++ Hirurust  .........1.1..1..1
++ Motaalba  .1.....1111..11111
++ Anthtriv  .........1....1.11
++ Trogtrog  ............11...1
++ Prunmodu  ..........11.....1
++ Turdpila  ................11
++ Turdphil  ........1....11.11
++ Turdmeru  ..1.1.11..1.111111
++ Turdilia  ...1.....1..11..11
++ Eritrube  .1.....1..1.1..111
++ Oenaoena  .......1....1...11
++ Phoephoe  .................1
++ Acroarun  .................1
++ Acroscir  ..............1.1.
++ Hippicte  ................11
++ Sylvatri  .................1
++ Sylvbori  ..........1....111
++ Sylvcurr  .....1.1..111.1111
++ Sylvcomm  .............11.1.
++ Phylsibi  ..........1.1.11..
++ Phyltrocs 1.1.11.1..1.111111
++ Phyltrocd ...........1....11
++ Reguregu  1...11.1..11111111
++ Muscstri  ...............111
++ Ficehypo  .............1..1.
++ Parumajo  ..1.....11.1.11111
++ Parucaer  1..............1..
++ Paruater  ...............1..
++ Parumont  ..........1......1
++ Cardchlo  ................11
++ Cardspin  ..1.11..11.1111111
++ Pyrrpyrr  ................1.
++ Loxicurv  ................11
++ Frincoel  111111111111111111
++ Sturvulg  ......1........1.1
++ Orioorio  .............1....
++ Corvcoro  .1..11111111.11111
++ Corvcora  ................1.
++ Garrglan  ..............1...
++  sites species 
++     18      50 
++> ## clean
++> rm(list = ls())
++> 
++> ### end commsimulator
++> 
++> ### set up permatfull/swap tests
++> 
++> data(mite)
++> data(mite.env)
++> x <- as.matrix(subset(mite, mite.env$Topo == "Blanket"))
++> x <- x[, colSums(x) > 0]
++> gsum <- sum(x)
++> rsum <- rowSums(x)
++> csum <- colSums(x)
++> fill <- sum(x>0)
++> rfrq <- rowSums(x>0)
++> cfrq <- colSums(x>0)
++> 
++> margintest <-
+++     function(x, gsum, rsum, csum, fill, rfrq, cfrq)
+++ {
+++     cat("grand sum: ")
+++     print(all.equal(sum(x), gsum, check.attributes = FALSE))
+++     cat("row sums:  ")
+++     print(all.equal(rowSums(x), rsum, check.attributes = FALSE))
+++     cat("col sums:  ")
+++     print(all.equal(colSums(x), csum, check.attributes = FALSE))
+++     cat("fill:      ")
+++     print(all.equal(sum(x>0), fill, check.attributes = FALSE))
+++     cat("row freqs: ")
+++     print(all.equal(rowSums(x>0), rfrq, check.attributes = FALSE))
+++     cat("col freqs: ")
+++     print(all.equal(colSums(x>0), cfrq, check.attributes = FALSE))
+++ }
++> 
++> ### permatfull
++> 
++> set.seed(4711)
++> margin <- c("none", "rows", "columns", "both")
++> shuffle <- c("ind", "samp", "both")
++> 
++> for(mar in margin) {
+++     for(what in shuffle) {
+++         cat("\n--> margin", mar, " shuffle", what, "<--\n")
+++         set.seed(4711)
+++         m <- permatfull(x, fixedmar = mar, shuffle = what, mtype = "count", 
+++             times=1)$perm[[1]]
+++         margintest(m, gsum, rsum, csum, fill, rfrq, cfrq)
+++         print(m[,1:12])
+++     }
+++ }
++
++--> margin none  shuffle ind <--
++grand sum: [1] TRUE
++row sums:  [1] "Mean relative difference: 0.4053168"
++col sums:  [1] "Mean relative difference: 1.1797"
++fill:      [1] "Mean relative difference: 0.5960133"
++row freqs: [1] "Mean relative difference: 0.5960133"
++col freqs: [1] "Mean relative difference: 0.6122867"
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       8    6    5    2    5       2    3    2    3    4     1    6
++9       4    3    4   11    2       5    3    4    3    2     6    3
++11      7    3    5    2    2       4    3    3    6    5     2    2
++14      2    7    1    3    5       1    4    5    7    6     8    6
++15      6    1    4    6    1       2    6    2    3    4     1    3
++19      4    6    2    5    5       8    4    7    3    5     3    3
++25      3    4    8    4    3       2    5    1    2    4     5    4
++30      2    5    4    3    1       4    2    8    5    2     2    1
++32      2    2    5    3    5       4    5    4    4    4     4    5
++33      1    4    3    2    2       7    4    1    3    3     2    1
++34      1    3    1    4    4       2    4    7    2    5     5    2
++35      4    5    3    8   10       6    2    6    5    1     6    3
++36      5    2    3    5    5       4    2    5    2    2     3    5
++37      2    5    5    5    5       1    6    5    3    3     1    2
++38      2    5    5    4    2       3    2    8    2    4     5    3
++39      2    8    7    2    2       4    5    5    6    2     1    5
++40      4    4    3    4    3       3    4    0    2    1     4    5
++41      5    7    5    3    4       3    2    2    6    4     2    6
++42      5    7    1    6    3       5    2    2    0    5     4    5
++43      8    7    2    4    1       1    4    2    2    1     7    3
++44      2    6    3    4    7       4    1    8    1    2     4    9
++45      6    4    3    1    5       3    3    3    3    1     6    5
++46      1    3    2    9    2       2    0    6    3    4     4    2
++47      5    7    5    4    3       8    2    4    1    5     5    5
++48      4    2    3    8    3       5    3    7    5    1     4    3
++49      6    4    1    3    5       4    3    3    3    3     6    2
++50      4    2    0    4    4       3    1    3    6    2     2    2
++51      1    1    3    2    4       1    3    5    2    5     6    5
++52      4    3    5    3    5       5    2    6    3    2     4    5
++53      3    4    9    5    2       0    2    5    3    3     2    2
++54      7    0    6    3    4       6    4    6    4    6     2    5
++55      0    5    2    8    5       3    4    6    2    4     3    2
++56      3    1    5    5    1       2    5    2    6    3     2    4
++57      3    5    5    2    1       4    4    5    4    3     5    2
++58      4    7    5    6    3       3    2    1    2    3     1    7
++59      2    3    1    0    5       5    2    6    4    5     6    6
++60      3    1    4    5    4       8    6    3    2    6     3    5
++61      4    4    2    4    4       6    6    6    6    4     6    4
++62      6    4    4    0    5       1    3    4    3    7     0    5
++63      4    5    2    3    2       3    4    4    2    3     3    2
++64      5    3    3    4    5       3    4    2    3    3     3    4
++66      2    6    3    4    2       4    1    5    2    1     5    5
++67      4    1    2    4    3       3    4    4    1    5     2    1
++68      3    5    6    3    6       4    4    4    1    6     1    1
++
++--> margin none  shuffle samp <--
++grand sum: [1] TRUE
++row sums:  [1] "Mean relative difference: 0.6473947"
++col sums:  [1] "Mean relative difference: 1.243225"
++fill:      [1] TRUE
++row freqs: [1] "Mean relative difference: 0.3908451"
++col freqs: [1] "Mean relative difference: 0.6542373"
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       0    1    0    3    0       0    0    0    0   73     0    0
++9       0    7    0    0    0       1    1    1    1    0     0    0
++11      0    0    0    0    0       0    0    0    1    0     2    0
++14      0    0    0   30    0       0    1    1    0    0     1    0
++15      2    3    4    0    0       1    1    0    0    0     8    0
++19      3    0    0    0    0       0   55    0    0    1     0    0
++25      3    0    0   20    0       0    0    8    7    0     0   56
++30      0    0    0    0    3      17    0    0    0    0     0    0
++32      0    0    7   17    1       0    1    2    2    0     3    0
++33     16    0    3    0    3       0    2    7    0    0     0    0
++34      2    0    0    8    0       1    0    0    2    2     0    0
++35      0    1    0    0   26       0    0    0    0    0     0    0
++36      0    1   20    6    0       2    0    0   34    1     0    2
++37      0    0    8    0   16       2    0    0    0    5     3   14
++38      0    0    0    1    0      17    0    0    0    0     0    3
++39      0    2    0    0    0       0    2    0    0    3     6    0
++40      0    0    0    0   24       0    0    0    1   12     7    2
++41      3   28    2    0    6       0    0    0    7    0     0    0
++42      0    0    9    1    0       0   57    1    3    0     0    0
++43      0    0    0    0    6       5    0    2    0    1     0    4
++44      0    1    0    0    0       0    0    0   17    0    15    0
++45      0    0    1   18    0       0    6    2    0    1     0    2
++46      0   20    0    1    0       0   10    2   10    5    23    0
++47      0    0    0    9    0       0    0   39    0    0     1    1
++48      0    3    2   14    0       0   21    1    0    0     2    0
++49      0    0   12    5    0       0    5    1    0    4     5    0
++50      0    0    1    5    0       8    0    0    0    0     0    0
++51      0    0    5    0   40      16    1    0    0    0     0    0
++52      0    0    0    0    0       0    0    0    0    2    18    0
++53      0    0    0    0    0       4    0    0    0    0     3    0
++54      2   20    0    0    4       0   12    0    0    0     0    0
++55      5    0    0   11    0       0    3    8    1    0     0    0
++56      0    0    0    0    0       0    0    0    0    0     0    2
++57      0    0    1    0    3       1    0    0    0    0     0   37
++58      1    9    0    0    0       4    0    0    0    0     0    3
++59      0    0    4    5    0       0   18    0    2    0     2    2
++60      5    0    1    0    5       2    0    1    2    3     0    0
++61      2    2    1    0   54       1    1    1    0    0     0    2
++62      0    0   20    2    0       5   26    0    3   15     8    0
++63      0    1    0    0    0       0    0    2    0    0     0    0
++64      0   22   44    0    4       1    9    5    2    0     1    6
++66      0    0    0    0    0       2    3    0    0    7     0    1
++67      5    6    0    0    1       0    0    0    5    0     0    0
++68     12    0    0    0    0       0    1    8    1    0     7    2
++
++--> margin none  shuffle both <--
++grand sum: [1] TRUE
++row sums:  [1] "Mean relative difference: 0.4389986"
++col sums:  [1] "Mean relative difference: 1.20342"
++fill:      [1] TRUE
++row freqs: [1] "Mean relative difference: 0.3670669"
++col freqs: [1] "Mean relative difference: 0.5723684"
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       0    7    9    7    6      12    0   10    0    0     0    0
++9      10    0   12    0   11       0    8    0    7    0     7    0
++11      6   14    9    0    6       0   12    0    0    7     0   11
++14      0   13    7    0    0       0    0    0    0    0     0   10
++15     15    0    0    0    9       0   11    0   16   11     0    0
++19      0    8    9    8    0       0   11   12    9    0    12    0
++25      0   12    7   10    0       7   12    0    0   10     0   12
++30      7    0    0    8    0      10    0    8    9    0     0    0
++32      8    0    0    0    0       0   11    0    0    0     0    0
++33     11    6    0    8    0       9    0    0    0    0     0    0
++34      0   15    9    7    0      13    5    7    0   11     0    0
++35     11    0    0    0    0       9    0    0    5    0     0    0
++36      0    0   10    9    9       0    0    9    0    7     4    0
++37      9    0    0   13    0       8    0    0    0    0     0    0
++38     10    7   10    9   10       0   10    0   14   11     6    0
++39      8    0    0    9    0       0    0    0    0   10     0    8
++40      0    8    0    0    0       0   12    0    0    0    11    0
++41      0    0   11    0   13       0    5   10   13    0     0   13
++42      0    7    7    0    0      11   16   11   11   14     0    7
++43      9   11    0    0    6       0    0    0    0    0    11   13
++44      9    0    0    7   14       8    0    7   10    0     7    0
++45      0    0    0    0    0       0    7    0   11    0     0    0
++46      9    9    0    0    0       9    7    0    0    0     0    0
++47      0    7    0    7   10       0    7   10   11    0     0    0
++48      9    7    0    9   12       0   12    8    7   10    10    0
++49      0    0    8    0    0       6    0    0    0    0     0    0
++50      0    0    9   11    8      15    0    0   15    9     0    7
++51      0    0    0    0    0      10    0    0    0    6     0   17
++52      0    8    0    0    3       0    0   10    8    0     0   10
++53      0    0    0    0    0       0   12    7    0    0    10    8
++54      9    6   10    0    6       6    0    0    7   14     0    0
++55      7    0    0    0    0       9    0    0   12    0     0    0
++56      0    0    8    0    0      17   10    8    0    0     0    0
++57      0   13    0    0   17      11   16    0    0    8     8   11
++58      0    4   12    0    6       0    0    0    0   15    12    8
++59      0    7    0    0    0       0    9    0    0   10     0   12
++60      0   10    0    0    0       7    0    0    0    0     0    0
++61      0    0   16    7    0      10    0    6    0    0     0    0
++62     11    0    4    0    5       9   11    8    0   12     0    9
++63      0    0    0    0    6       0    0    0    9   11     0    0
++64      0    0    2    7    0       0    0    0   10    3     0    0
++66      0    0    0    0    5       0   11    0    0    0     0    8
++67      0    0    0   11    0       0    9    0    6    0     8    0
++68     13    0    0    0    0       0    9    0    0    0     0   10
++
++--> margin rows  shuffle ind <--
++grand sum: [1] TRUE
++row sums:  [1] TRUE
++col sums:  [1] "Mean relative difference: 1.1797"
++fill:      [1] "Mean relative difference: 0.5715292"
++row freqs: [1] "Mean relative difference: 0.5715292"
++col freqs: [1] "Mean relative difference: 0.6076233"
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       7    4    6    2    6       4    2    2    2    1     1    4
++9       4    2    2    4    5       4    5    1    4    3     5    3
++11      5    6    4    2    6       6    1    8    2    9    11    5
++14      9   12    6    9    4       6    6    7    5   10     7    4
++15      4    4    3    2    2       2    3    7    4    3     3    1
++19      0    2    4    4    4       3    4    2    2    4     1    5
++25      5    1    3    4    0       1    3    5    4    4     5    2
++30      3    0    3    2    1       7    4    3    2    1     4    0
++32      4    3    3    1    1       4    1    4    3    1     1    3
++33      4    4    2    4    3       5    2    7    1    8     4    1
++34      3    7    3    8    4       9    5    6    4    7     5    5
++35      3    1    4    3    5       2    2    3    4    2     5    4
++36      2    3    4    2    1       4    6    1    2    1     4    6
++37      2    9    1    4    6       2    4    2    5    6     3    2
++38      4    8    1    4    5       7    3    3    9    5     3    9
++39      1    4    4    1    4       1    3    1    6    5     3    2
++40      3    3    5    9    1       4    7    5    7    6     1    2
++41      4    3    3    3    3       2    2    0    3    1     4    2
++42      4    4    6    3    1       5    3    2    6    4     3    3
++43      3    3    6    2    8       4    6    4    4    5     1    4
++44      2    2    0    1    2       2    3    0    2    1     2    3
++45      6    7    3    8    3       2    2    4    5    8     1    4
++46      5    4    7    2    2       5    3    7    6    7     3    4
++47      4    4    3    3    1       5    2    3    4    6     5    4
++48      5    4    4    4    3       1    3    4    0    4     2    4
++49      2    6    1    1    0       1    6    5    3    2     1    2
++50      3    4    6    4    6       1    6    6    4    5     5    4
++51      0    2    2    7    3       3    4    5    7    4     3    5
++52      2    3    8    1    7       2    4    3    3    5     2    3
++53      5    7    3    5    3       5    3    6    7    4     4    5
++54      1    0    3    1    0       2    3    1    1    1     1    0
++55      0    1    2    2    3       5    0    1    2    0     2    3
++56      2    4    2    2    2       2    2    3    7    1     3    5
++57      0    1    0    0    0       0    1    0    0    1     0    0
++58      5    3    3    4    2       5    9    3    4    3     3    2
++59      7    2    2    2    4       3    0    1    2    1     3    3
++60      5    7    3    4    6       2    3    3    7    1     6    2
++61      2    0    1    1    1       1    1    1    1    2     1    4
++62      0    0    0    0    0       0    1    0    0    1     0    1
++63      3    2    0    3    3       2    2    1    1    0     4    1
++64      2    3    6    3    2       3    2    1    2    1     0    1
++66      2    1    6    2    4       2    2    4    5    1     1    2
++67     15   24   21   18   36      22   25   21   18   21    19   28
++68      6    4    4    2    0       4    6    1    1    1     4    6
++
++--> margin rows  shuffle samp <--
++grand sum: [1] TRUE
++row sums:  [1] TRUE
++col sums:  [1] "Mean relative difference: 1.173485"
++fill:      [1] TRUE
++row freqs: [1] TRUE
++col freqs: [1] "Mean relative difference: 0.6414474"
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       0    1    0    2    1       3    1    1    0    8     4    0
++9       1    3    0    0    1       0    2   19   20    0     9    0
++11      0    7   42    2   36       1    1    1    3    0    35   17
++14      8   12    0   24    3       0    2   20    0   41     1    5
++15      7    0    0    0    0       1    8    0    0    0     1    0
++19     14    0    1    0    0       2    0    2   10    0     0    0
++25     32    0    0    0    0       0    0    2    2    0     0    2
++30      0   18    0    0   20       1    0    7    1    0     2    0
++32      0    0    5    0    9       2    4    0    2    5     0    0
++33      2    0    0   23    0       0    1    0    1   38     1    1
++34      0    2   22   39    2       1    1    0    1    0     9    0
++35      0    0    1    0    4       2    1    0    2    0     3   21
++36      2   12    0    0    0       3    0    1    0    0     3    0
++37      0    0    0    0    1       3    0   22    2    0     0    2
++38      0    0    0    0   15       4    1    0    0    1     8    0
++39      0    0    0    0    0       0   40    3    0    0     0    0
++40     26   65    0    0    0       0    1    5    0    0     0    0
++41      0    5    0    0    0       2    0    0    0    0     0    1
++42      0    1    0    0    0       0    0    7    6    0     0    0
++43      0    0    1    3    7       0    0    0   16   14     0    0
++44      0    0   28    0    0       0    0    0    0    0     0    0
++45     11    0    1    1    1       0    0    4    1   52     6    6
++46      0    0    0   12    4       1    0   28   42    0     5    4
++47      0    1    0    1   24       0   20    0    0    0     0    0
++48     10    0    0    3    0      53    0   29    0    0     0    4
++49      7    0    7    0   17       0    0    0    0    1     0    0
++50      8    0   14    3    2       0    0    0    0    0     0    0
++51      3    0    0    3    0       0    0    0    0    0     0    1
++52     46    0    0    0    0       3    0    0    0    0     1    0
++53      3    0    0    0    0      10   17    0    0   25     0    2
++54      0    0    0    0    0       0    1    0    0    0     0    0
++55      0    0    0    0    0       0    5    0    0    0     0    0
++56      0   54    3    0    0      17    0    0    0    0     0    0
++57      0    0    0    0    0       0    0    0    0    0     1    2
++58      1    1    0    2    0       0    1    0   12    0    57    0
++59      0    0    0    0    0       0    0    2    0    0     0   29
++60      0    1    0    0    4       0   28    1    1   16    55    0
++61      0    0    5    3    9       0    0    0    0    0     0    0
++62      0    0    0    0    3       2    0    0    1    0     1    0
++63      0    2    2    2    0       0   19    8    0    0     0    1
++64      0    0    1    0    0       0    0    4    0    3     0    0
++66      0    0    0    0    0       0    1    0    3    0     9   21
++67      0    4    0   11    0       7    0    0    0  723     0    0
++68      0    0    0    3    1       0    0   22    0    3     0    0
++
++--> margin rows  shuffle both <--
++grand sum: [1] TRUE
++row sums:  [1] TRUE
++col sums:  [1] "Mean relative difference: 1.251856"
++fill:      [1] TRUE
++row freqs: [1] TRUE
++col freqs: [1] "Mean relative difference: 0.6503497"
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       6    0    6    0    0       9    4    0    0    4     0   10
++9       0    6    8    3    9       0    0    0    0    0     9    6
++11      5    6    0    0   10       0    4    5    7    0    11    0
++14      9    0   12    8   13       0    0   13   13   13    15    0
++15      0    6    0    4    0       6    2    0    0    0     8    7
++19      4    0    0    6    2       8    3    0    0    0     3    4
++25      0    0    5    0    3       7    9    7    4    0     0    0
++30      4    3    0    3    0       0    5    6    5    5     3    8
++32      0    8    0    0    3       8    0    2    0   11     0    6
++33     11    0    0    0    0       0    0    0    8   12     0    7
++34     10    9    0    0    9       8   12    0    0    0    10    0
++35      6    5    0    9    0       2    0    0    4    0     0    0
++36      6    5    8    0    0       0    6    0    0    0     4   12
++37      0    0    0    7    8       0    0   12   10    0    13    0
++38      0    8   14   15   14       0    0   13   12    0     0    0
++39      9    0    0    4    8       0    8    0    9    0     0   13
++40      0    0    0    0   10      14    0    0    0    0     0    0
++41      0    3    9    0    0       0    0    0    0    9     7    0
++42     21    0    0    0   12      17    0    0   15    0    15    0
++43      0    0    0    0    0      13   17    0   12    0     0   13
++44      0   13    0    0    0       0    0    0    0   17     0    0
++45      0    0    6   10    9       8    0    8    6   16     0    9
++46      0    0    0    8    9      13    0   12    0    7     0    4
++47     13    5   13    9    0       0    9    0    0    0     6    7
++48      0    0    8    0    0       0    0    0   12   11    12    0
++49      0    7    0   10    0       0    0    8   14    0     7    8
++50      0    0    0   10   13      11    0    0    0    0    18   13
++51      0    5    0    7    0       6    0    0    5    7     0   11
++52      0    0    0    0    5      12    0    0    0    0     0    0
++53      9    0    5    0    7       0    0    8    0    0     0   12
++54      0    0    0   11    0       0    0    0    6    4     5    0
++55      0    0    6    3    0       0    7    8    0    0     9    0
++56     13    0   14    0    0       0    7    0   13    9     0    0
++57      0    0    0    0    0       0    0    1    0    0     0    0
++58     16    0    0   10   10       0    0    9    0    0     0    0
++59      0    0   18    0   13       0    0    0    0    0     0   13
++60      0    0    0    9    0      10   13    0    0    0     0   15
++61      0    0    3    8    0       0    0    0    5    0     0    0
++62      0    3    1    0    1       0    5    0    0    0     0    0
++63      0    0    0    8   10       0    0    0    7    0     0    7
++64      0    0    0    0    0       7    0    5    5    9     0    0
++66      0    6    0    0    9       0    5    0    7    7     0    0
++67      0  136    0    0  147       0  133    0    0    0     0    0
++68      7    0    0    0    0       5    7    0    0    9     0    5
++
++--> margin columns  shuffle ind <--
++grand sum: [1] TRUE
++row sums:  [1] "Mean relative difference: 0.4160623"
++col sums:  [1] TRUE
++fill:      [1] "Mean relative difference: 0.3566138"
++row freqs: [1] "Mean relative difference: 0.406423"
++col freqs: [1] "Mean relative difference: 0.3577495"
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8      12    0    4    0    0       0    1    0    0    1     0    2
++9       7    1   12    0    0       0    1    0    2    3     0    4
++11     10    0   12    1    0       0    2    0    1    4     0    2
++14      4    0   11    0    0       0    1    0    3    1     1    3
++15     10    2   12    3    0       1    3    0    0    5     2    1
++19      7    0    5    0    0       0    5    0    0    4     0    2
++25      5    1   10    0    0       0    3    0    2    7     1    1
++30      4    1    8    1    0       0    0    1    2    3     0    3
++32      5    1   16    0    0       0    2    0    2    3     2    1
++33      3    0   10    0    0       1    1    0    2    4     1    3
++34      3    1   12    0    0       0    2    0    2    5     1    2
++35      8    0    8    0    0       0    1    0    0    3     3    1
++36      9    1    5    0    0       0    2    0    1    6     2    1
++37      5    0    8    0    0       0    2    0    0    5     1    1
++38      4    1    9    2    0       0    1    0    2    3     1    1
++39      4    1   12    1    0       1    1    0    0    4     1    2
++40      7    2   11    0    0       0    2    0    2    2     2    0
++41      9    1   14    0    0       0    4    0    1    7     3    3
++42      8    2    8    0    0       0    2    0    1    4     1    1
++43     13    2   12    0    0       1    3    1    0    2     4    3
++44      4    2    5    0    2       0    1    0    1    4     1    0
++45     10    1    8    1    0       1    3    1    1    3     1    1
++46      3    0    8    0    0       0    3    0    1    2     0    1
++47      8    0    9    0    0       0    2    0    0    1     2    2
++48      7    1    7    0    0       0    1    1    0    5     2    1
++49     10    0   13    2    0       0    0    0    2    3     0    0
++50      8    0    9    0    0       0    3    0    2    6     3    4
++51      3    0    6    2    0       0    1    0    0    7     0    1
++52      7    0    5    0    0       0    3    1    0    5     4    1
++53      6    0   10    0    1       0    3    0    0    6     0    4
++54     11    0   13    0    0       0    1    0    1    4     1    1
++55      0    0   18    0    0       0    1    0    1    2     2    1
++56      6    1   13    1    0       0    2    0    0    5     0    2
++57      6    0    7    0    0       2    0    0    0    3     1    0
++58      8    1   11    1    0       0    2    1    1    6     0    3
++59      4    2   13    0    0       0    0    0    0    2     2    0
++60      6    0   12    0    0       0    1    0    0    3     3    1
++61      8    0    5    1    0       0    3    0    0    5     1    1
++62     10    0   10    0    0       1    2    0    3    6     0    3
++63      8    0    8    0    0       0    1    0    0    3     2    1
++64      9    1   10    0    0       1    3    0    2    3     0    3
++66      4    0    7    0    0       0    3    0    0    7     3    3
++67      8    1   12    0    0       0    4    0    1    8     1    3
++68      8    0   12    0    1       0    6    0    2    4     3    2
++
++--> margin columns  shuffle samp <--
++grand sum: [1] TRUE
++row sums:  [1] "Mean relative difference: 0.6283446"
++col sums:  [1] TRUE
++fill:      [1] TRUE
++row freqs: [1] "Mean relative difference: 0.3269565"
++col freqs: [1] TRUE
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       4    0    3    0    0       1    5    1    0    0     6    2
++9       0    0    4    0    0       0    3    0    3    0     0    0
++11      3    0   16    0    0       0    2    0    2    0     9    1
++14     20    0    2    0    0       0    0    0    0    2     0    0
++15      1    5    8    0    0       0    0    0    0   18     3    1
++19      6    0   14    0    0       0    0    0    2    0     0    0
++25      3    0    9    0    0       0    0    0    0    0     0    2
++30     12    0    8    0    2       0    2    0    0    0     0    1
++32     38    0    3    0    0       0    0    0    0   12     0    2
++33     36    0    5    0    0       0    0    0    0   11     2    3
++34      0    0   16    0    0       0   16    0    0    1     0    1
++35     11    0   12    0    0       0    5    0    7    0     0    0
++36     10    0    0    0    0       0    2    0    0    0     4    1
++37      3    0    3    0    0       2    2    0    0    0    20    0
++38      1    0   16    0    0       0    4    0    3    0     0    0
++39     41    0   37    0    0       0    0    0    3   24     0    0
++40      3    0    9    0    0       0    0    0    0    0     0    0
++41      4    0    2    0    0       0    0    0    4    0     5    5
++42      2    0    0    0    0       0    0    1    0    1     0    0
++43      8    0   10    0    1       1   15    0    0    0     0    2
++44      3    0    2    0    0       0    5    0    0   16     0    1
++45      0    0    5    9    0       0    0    0    0    0     0    0
++46      3    4    6    0    0       0    3    0    1   26     0    1
++47      0    0   10    0    0       0    0    0    0    3     0    4
++48      5    2    7    0    0       1    0    0    4    0     0    2
++49      1    0   14    0    0       1    0    0    0    0     0    1
++50      3    0    8    0    0       0   12    0    0    0     0    9
++51      1    4    2    0    0       0    1    0    0    1     0    0
++52     19    0    2    2    0       0    0    0    0    0     0    0
++53      3    1    6    0    1       2    0    0    1    1     0    3
++54      2    0   22    1    0       1    7    2    2   20     0    2
++55      5    0   35    0    0       0    0    0    2    0     0    1
++56      0    0    4    0    0       0    2    0    1    0     0    0
++57      6    0    5    0    0       0    0    0    0    0     0    0
++58     12    0   31    0    0       0    0    0    0    0     4    2
++59      1    7    0    2    0       0    0    0    0   36     0    0
++60      0    0   17    0    0       0    0    0    0    0     0    7
++61      0    0   12    0    0       0    0    1    3    0     5    4
++62      8    0    0    0    0       0    0    0    1    0     0    1
++63      4    0   18    2    0       0    1    1    2    0     0   10
++64      5    3   15    0    0       0    0    0    0    0     0    0
++66      6    1   12    0    0       0    0    0    0    1     0    1
++67      4    0   17    0    0       0    1    0    0    5     0    6
++68      2    0    3    0    0       0    0    0    0    1     0    0
++
++--> margin columns  shuffle both <--
++grand sum: [1] TRUE
++row sums:  [1] "Mean relative difference: 0.4073882"
++col sums:  [1] TRUE
++fill:      [1] TRUE
++row freqs: [1] "Mean relative difference: 0.3514938"
++col freqs: [1] TRUE
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       6    0   15    0    0       0    6    0    4    5     0    2
++9      14    0   17    0    0       0    0    0    0   11     0    3
++11      8    0   10    4    0       0    0    0    2    0     0    2
++14     12    0   16    0    0       0    0    0    0    0     8    3
++15     12    4    6    0    0       0    4    0    0   15     0    0
++19     11    0    0    0    0       0    4    0    4   11     0    0
++25      0    0   11    0    0       0    0    0    0   15     0    2
++30      5    0    9    0    0       0    0    0    0    0     6    0
++32      8    0   10    0    0       0    0    0    2    0     0    3
++33      7    0   12    0    0       0    0    0    3    7     7    0
++34     11    0    9    0    0       1    0    0    0    0     0    0
++35      9    0   18    0    0       0    3    0    0    0     0    0
++36     12    0   11    2    1       0    0    0    0    0     0    3
++37      8    0   21    0    0       0    3    1    0    0     0    4
++38      8    0    9    0    0       0    0    0    2   10     6    0
++39     12    0   13    4    0       0    7    0    0    0     0    3
++40      5    0   12    0    0       0    6    0    4    0     0    0
++41      0    0   10    0    0       0    0    0    4    0     0    1
++42      9    0    9    0    0       0    0    0    0    0     0    0
++43      0    0   10    0    0       0    0    0    0   11     0    2
++44      7    3    0    0    0       0    3    0    0   12     0    0
++45      8    5    7    2    0       0    1    0    0    0     0    1
++46      7    1   12    0    1       0    4    0    3   14     0    0
++47     10    4    8    0    0       0    4    0    0    0     0    0
++48      5    0   14    0    0       0    0    0    1    0     0    2
++49     10    0    9    0    0       0    0    0    0   13     0    5
++50      0    0    3    0    2       0    7    0    0    8     0    4
++51      0    2   11    0    0       2    0    0    1    7     9    3
++52      0    0   11    0    0       1    6    1    0    6     6    2
++53      5    0   10    0    0       0    4    0    0    0     0    3
++54      4    0    7    0    0       0    0    0    0   13     0    0
++55     10    0   10    4    0       1    6    0    0    0     5    1
++56     10    3   10    0    0       2    0    0    0    0     4    4
++57      8    0    8    0    0       0    0    0    2    0     0    2
++58      4    0    0    0    0       1    4    1    0   10     0    5
++59     13    5    0    0    0       0    0    0    1    0     0    0
++60     11    0    8    0    0       0    0    0    0    0     0    0
++61      5    0    9    0    0       0    0    0    4    0     0    4
++62      6    0    7    0    0       1    0    1    0    0     0    3
++63      0    0   12    0    0       0    0    0    0    0     0    0
++64      4    0   15    0    0       0    8    0    0    0     0    3
++66      6    0   11    0    0       0    0    2    0    0     7    4
++67      8    0    8    0    0       0    8    0    2    0     0    0
++68      1    0   12    0    0       0    0    0    2   11     0    2
++
++--> margin both  shuffle ind <--
++grand sum: [1] TRUE
++row sums:  [1] TRUE
++col sums:  [1] TRUE
++fill:      [1] "Mean relative difference: 0.3059361"
++row freqs: [1] "Mean relative difference: 0.3301435"
++col freqs: [1] "Mean relative difference: 0.3117783"
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       2    0    5    0    0       0    3    0    1    4     1    1
++9       4    1    8    0    0       0    4    0    2    3     0    1
++11     10    2   15    1    0       0    3    0    1    4     5    4
++14     18    3   22    0    0       0    5    0    2   12     2    3
++15      2    1   10    0    0       0    2    1    0    5     0    1
++19      6    0   12    0    0       0    1    0    1    2     1    4
++25      4    1   11    1    0       0    3    0    0    3     0    3
++30      3    0    5    0    0       1    0    0    2    3     0    1
++32      3    0    5    0    0       0    1    0    0    4     1    0
++33      9    0   11    0    0       0    2    1    1    0     2    2
++34     12    0   14    0    0       1    2    0    1    9     1    1
++35      5    1    5    0    0       0    3    0    0    5     0    1
++36      8    0   13    0    0       0    4    0    1    4     2    0
++37      8    3   10    0    0       0    1    0    0    7     1    2
++38      9    0   14    1    0       0    3    0    3    5     2    6
++39      5    1   10    0    0       0    2    0    0    6     0    2
++40      7    1   10    3    0       0    0    0    0    8     2    2
++41      1    0    9    0    0       0    2    0    0    2     0    2
++42      6    0   15    0    0       0    3    0    0    3     3    2
++43      7    1   15    0    1       0    4    0    2    6     2    1
++44      5    0    4    0    0       0    0    0    1    3     0    0
++45      6    0   10    0    0       0    2    0    2    9     2    3
++46     12    0   16    1    0       0    2    1    0    1     3    1
++47      5    0    7    0    0       1    2    0    0    0     0    1
++48      3    0   11    1    0       0    1    0    1    5     1    2
++49      7    0    7    0    0       0    4    0    2    3     1    1
++50      8    2    7    0    0       0    0    1    2    6     1    1
++51      5    0    7    2    0       0    0    0    3    0     0    3
++52      7    2    2    0    1       0    1    0    0    1     1    2
++53      6    0   12    1    0       1    2    0    3    6     1    4
++54      2    0    7    0    0       0    0    0    0    1     0    1
++55      3    0    3    0    0       2    1    0    1    2     0    0
++56      5    0    9    0    0       0    3    0    0    3     2    0
++57      1    0    1    0    0       0    1    0    0    1     0    0
++58     10    0    7    0    0       0    2    0    2    6     1    2
++59      4    1    8    0    0       1    0    0    0    0     1    3
++60      3    1   14    0    0       0    2    0    1    5     2    1
++61      2    0    4    1    0       0    0    0    0    0     0    0
++62      0    0    0    0    0       0    0    0    0    0     0    0
++63      6    1    5    0    0       0    2    0    0    2     0    1
++64      6    0    7    0    0       0    2    0    0    1     4    1
++66      7    1    8    0    0       0    2    0    0    4     1    1
++67     49    4   45    3    2       2   11    1    4   23     9    8
++68      8    0   10    1    0       0    0    1    2    2     3    1
++
++--> margin both  shuffle samp <--
++grand sum: [1] TRUE
++row sums:  [1] TRUE
++col sums:  [1] TRUE
++fill:      [1] "Mean relative difference: 0.3059361"
++row freqs: [1] "Mean relative difference: 0.3301435"
++col freqs: [1] "Mean relative difference: 0.3117783"
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       2    0    5    0    0       0    3    0    1    4     1    1
++9       4    1    8    0    0       0    4    0    2    3     0    1
++11     10    2   15    1    0       0    3    0    1    4     5    4
++14     18    3   22    0    0       0    5    0    2   12     2    3
++15      2    1   10    0    0       0    2    1    0    5     0    1
++19      6    0   12    0    0       0    1    0    1    2     1    4
++25      4    1   11    1    0       0    3    0    0    3     0    3
++30      3    0    5    0    0       1    0    0    2    3     0    1
++32      3    0    5    0    0       0    1    0    0    4     1    0
++33      9    0   11    0    0       0    2    1    1    0     2    2
++34     12    0   14    0    0       1    2    0    1    9     1    1
++35      5    1    5    0    0       0    3    0    0    5     0    1
++36      8    0   13    0    0       0    4    0    1    4     2    0
++37      8    3   10    0    0       0    1    0    0    7     1    2
++38      9    0   14    1    0       0    3    0    3    5     2    6
++39      5    1   10    0    0       0    2    0    0    6     0    2
++40      7    1   10    3    0       0    0    0    0    8     2    2
++41      1    0    9    0    0       0    2    0    0    2     0    2
++42      6    0   15    0    0       0    3    0    0    3     3    2
++43      7    1   15    0    1       0    4    0    2    6     2    1
++44      5    0    4    0    0       0    0    0    1    3     0    0
++45      6    0   10    0    0       0    2    0    2    9     2    3
++46     12    0   16    1    0       0    2    1    0    1     3    1
++47      5    0    7    0    0       1    2    0    0    0     0    1
++48      3    0   11    1    0       0    1    0    1    5     1    2
++49      7    0    7    0    0       0    4    0    2    3     1    1
++50      8    2    7    0    0       0    0    1    2    6     1    1
++51      5    0    7    2    0       0    0    0    3    0     0    3
++52      7    2    2    0    1       0    1    0    0    1     1    2
++53      6    0   12    1    0       1    2    0    3    6     1    4
++54      2    0    7    0    0       0    0    0    0    1     0    1
++55      3    0    3    0    0       2    1    0    1    2     0    0
++56      5    0    9    0    0       0    3    0    0    3     2    0
++57      1    0    1    0    0       0    1    0    0    1     0    0
++58     10    0    7    0    0       0    2    0    2    6     1    2
++59      4    1    8    0    0       1    0    0    0    0     1    3
++60      3    1   14    0    0       0    2    0    1    5     2    1
++61      2    0    4    1    0       0    0    0    0    0     0    0
++62      0    0    0    0    0       0    0    0    0    0     0    0
++63      6    1    5    0    0       0    2    0    0    2     0    1
++64      6    0    7    0    0       0    2    0    0    1     4    1
++66      7    1    8    0    0       0    2    0    0    4     1    1
++67     49    4   45    3    2       2   11    1    4   23     9    8
++68      8    0   10    1    0       0    0    1    2    2     3    1
++
++--> margin both  shuffle both <--
++grand sum: [1] TRUE
++row sums:  [1] TRUE
++col sums:  [1] TRUE
++fill:      [1] "Mean relative difference: 0.3059361"
++row freqs: [1] "Mean relative difference: 0.3301435"
++col freqs: [1] "Mean relative difference: 0.3117783"
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       2    0    5    0    0       0    3    0    1    4     1    1
++9       4    1    8    0    0       0    4    0    2    3     0    1
++11     10    2   15    1    0       0    3    0    1    4     5    4
++14     18    3   22    0    0       0    5    0    2   12     2    3
++15      2    1   10    0    0       0    2    1    0    5     0    1
++19      6    0   12    0    0       0    1    0    1    2     1    4
++25      4    1   11    1    0       0    3    0    0    3     0    3
++30      3    0    5    0    0       1    0    0    2    3     0    1
++32      3    0    5    0    0       0    1    0    0    4     1    0
++33      9    0   11    0    0       0    2    1    1    0     2    2
++34     12    0   14    0    0       1    2    0    1    9     1    1
++35      5    1    5    0    0       0    3    0    0    5     0    1
++36      8    0   13    0    0       0    4    0    1    4     2    0
++37      8    3   10    0    0       0    1    0    0    7     1    2
++38      9    0   14    1    0       0    3    0    3    5     2    6
++39      5    1   10    0    0       0    2    0    0    6     0    2
++40      7    1   10    3    0       0    0    0    0    8     2    2
++41      1    0    9    0    0       0    2    0    0    2     0    2
++42      6    0   15    0    0       0    3    0    0    3     3    2
++43      7    1   15    0    1       0    4    0    2    6     2    1
++44      5    0    4    0    0       0    0    0    1    3     0    0
++45      6    0   10    0    0       0    2    0    2    9     2    3
++46     12    0   16    1    0       0    2    1    0    1     3    1
++47      5    0    7    0    0       1    2    0    0    0     0    1
++48      3    0   11    1    0       0    1    0    1    5     1    2
++49      7    0    7    0    0       0    4    0    2    3     1    1
++50      8    2    7    0    0       0    0    1    2    6     1    1
++51      5    0    7    2    0       0    0    0    3    0     0    3
++52      7    2    2    0    1       0    1    0    0    1     1    2
++53      6    0   12    1    0       1    2    0    3    6     1    4
++54      2    0    7    0    0       0    0    0    0    1     0    1
++55      3    0    3    0    0       2    1    0    1    2     0    0
++56      5    0    9    0    0       0    3    0    0    3     2    0
++57      1    0    1    0    0       0    1    0    0    1     0    0
++58     10    0    7    0    0       0    2    0    2    6     1    2
++59      4    1    8    0    0       1    0    0    0    0     1    3
++60      3    1   14    0    0       0    2    0    1    5     2    1
++61      2    0    4    1    0       0    0    0    0    0     0    0
++62      0    0    0    0    0       0    0    0    0    0     0    0
++63      6    1    5    0    0       0    2    0    0    2     0    1
++64      6    0    7    0    0       0    2    0    0    1     4    1
++66      7    1    8    0    0       0    2    0    0    4     1    1
++67     49    4   45    3    2       2   11    1    4   23     9    8
++68      8    0   10    1    0       0    0    1    2    2     3    1
++> 
++> ### permatswap
++> set.seed(4711)
++> methods <- c("swap", "quasiswap", "swsh", "abuswap")
++> margins <- c("rows", "columns", "both")
++> shuffle <- c("samp", "both")
++> 
++> incompatible <- function(method, margin)
+++ {
+++     (method == "swap" && margin != "both") ||
+++     (method == "abuswap" && margin == "both") ||
+++     (method == "quasiswap" && margin != "both") ||
+++     (method == "swsh" && margin == "both")
+++ }
++> 
++> for(method in methods) {
+++     for(margin in margins) {
+++         for(what in shuffle) {
+++             if (incompatible(method = method, margin = margin))
+++                 next
+++             cat("\n*** ", method, " ***\n")
+++             cat("--> margin", margin, " shuffle", what, "<--\n")
+++             set.seed(4711)
+++             m <- permatswap(x, method = method, fixedmar = margin, shuffle = what,
+++                              mtype = "count", thin=100, times=1)$perm[[1]]
+++             margintest(m, gsum, rsum, csum,fill, rfrq, cfrq)
+++             print(m[,1:12])
+++         }
+++     }
+++ }
++
++***  swap  ***
++--> margin both  shuffle samp <--
++grand sum: [1] TRUE
++row sums:  [1] TRUE
++col sums:  [1] TRUE
++fill:      [1] TRUE
++row freqs: [1] "Mean relative difference: 0.1074766"
++col freqs: [1] "Mean relative difference: 0.08316008"
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       0    3    0    2    1       0    2    0    0    1     4   10
++9       3    3    2    2    1       1   12    0    0    0     3    6
++11     38    5   35    9    0       0    5    0    1    0     6    2
++14     41    5   15    0    2       0    2    0    0   24    20    6
++15     11    0    6    0    0       0    1    0    0    0     5    1
++19     14    1    6    0    0       0    4    0    0   16     4    2
++25     12    4   12    2    0       1    0    0    1    1     2    1
++30     20    1    3    0    0       0    7    1    0    0     0    1
++32      4    0    9    0    0       0    5    0    0    5     9    2
++33     38    2   20    0    0       0    2    0    0    1     0    0
++34      5    0   18    1    0       0    1    0    1   12     4    1
++35      1    0    4    0    0       1    1    2    0   26     0    0
++36      3    1    2    0    0       1    3    0    0   20     0    0
++37      3    0    5    0    0       0    2    1    0   36     0    0
++38     13    0   11    0    0       0   12    0    4    0     0    0
++39      2    0    1    0    0       0    0    0    0    0     0    0
++40      1    0   31    0    0       0    0    0    0    1     0    3
++41      2    0    9    0    0       0    0    0    0    0     0    1
++42      0    0   12    0    0       1    0    0    2    0     0    1
++43      5    0    2    0    0       0    1    0    0    0     0    1
++44      0    0    0    0    0       0    6    0    0    0     0    0
++45     11    0    8    0    0       2    0    0    0    1     0    4
++46      4    0    0    0    0       0    2    0    1   12     0    2
++47      0    0    8    0    0       1    0    0    0   18     0    1
++48      0    0    3    0    0       0    0    0    0    0     0    1
++49     10    0    5    0    0       0    0    0    0    1     0    6
++50      4    0   37    0    0       0    0    0    2    2     0    0
++51      0    0    5    0    0       1    0    0    3    0     1    0
++52      1    0   12    0    0       0    2    0    2    2     0    0
++53      0    0   13    0    0       0    3    0    2    0     0    1
++54      2    0    7    0    0       0    0    0    0    0     0    1
++55      1    0    3    0    0       0    0    1    0    0     0    5
++56      1    0   16    0    0       0    0    0    3    0     0    0
++57      0    0    0    0    0       0    0    0    1    0     0    0
++58      0    0   13    0    0       0    0    1    0    0     0    0
++59      1    0    0    0    0       0    0    0    2    0     0    0
++60      1    2   16    0    0       0    0    0    7    0     0    0
++61      6    0    9    0    0       0    0    0    0    0     0    0
++62      3    0    0    0    0       0    0    0    1    0     0    0
++63     19    0    2    0    0       0   15    0    0    0     0    2
++64      1    0   27    0    0       0    0    0    3    0     0    3
++66      8    0   18    0    0       0    0    0    4    0     0    6
++67      4    0    3    0    0       0    0    0    0    0     0    2
++68      6    0   22    0    0       0    0    0    1    0     0    4
++
++***  swap  ***
++--> margin both  shuffle both <--
++grand sum: [1] TRUE
++row sums:  [1] TRUE
++col sums:  [1] TRUE
++fill:      [1] TRUE
++row freqs: [1] "Mean relative difference: 0.1074766"
++col freqs: [1] "Mean relative difference: 0.08316008"
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       0    3    0    2    1       0    2    0    0    1     4   10
++9       3    3    2    2    1       1   12    0    0    0     3    6
++11     38    5   35    9    0       0    5    0    1    0     6    2
++14     41    5   15    0    2       0    2    0    0   24    20    6
++15     11    0    6    0    0       0    1    0    0    0     5    1
++19     14    1    6    0    0       0    4    0    0   16     4    2
++25     12    4   12    2    0       1    0    0    1    1     2    1
++30     20    1    3    0    0       0    7    1    0    0     0    1
++32      4    0    9    0    0       0    5    0    0    5     9    2
++33     38    2   20    0    0       0    2    0    0    1     0    0
++34      5    0   18    1    0       0    1    0    1   12     4    1
++35      1    0    4    0    0       1    1    2    0   26     0    0
++36      3    1    2    0    0       1    3    0    0   20     0    0
++37      3    0    5    0    0       0    2    1    0   36     0    0
++38     13    0   11    0    0       0   12    0    4    0     0    0
++39      2    0    1    0    0       0    0    0    0    0     0    0
++40      1    0   31    0    0       0    0    0    0    1     0    3
++41      2    0    9    0    0       0    0    0    0    0     0    1
++42      0    0   12    0    0       1    0    0    2    0     0    1
++43      5    0    2    0    0       0    1    0    0    0     0    1
++44      0    0    0    0    0       0    6    0    0    0     0    0
++45     11    0    8    0    0       2    0    0    0    1     0    4
++46      4    0    0    0    0       0    2    0    1   12     0    2
++47      0    0    8    0    0       1    0    0    0   18     0    1
++48      0    0    3    0    0       0    0    0    0    0     0    1
++49     10    0    5    0    0       0    0    0    0    1     0    6
++50      4    0   37    0    0       0    0    0    2    2     0    0
++51      0    0    5    0    0       1    0    0    3    0     1    0
++52      1    0   12    0    0       0    2    0    2    2     0    0
++53      0    0   13    0    0       0    3    0    2    0     0    1
++54      2    0    7    0    0       0    0    0    0    0     0    1
++55      1    0    3    0    0       0    0    1    0    0     0    5
++56      1    0   16    0    0       0    0    0    3    0     0    0
++57      0    0    0    0    0       0    0    0    1    0     0    0
++58      0    0   13    0    0       0    0    1    0    0     0    0
++59      1    0    0    0    0       0    0    0    2    0     0    0
++60      1    2   16    0    0       0    0    0    7    0     0    0
++61      6    0    9    0    0       0    0    0    0    0     0    0
++62      3    0    0    0    0       0    0    0    1    0     0    0
++63     19    0    2    0    0       0   15    0    0    0     0    2
++64      1    0   27    0    0       0    0    0    3    0     0    3
++66      8    0   18    0    0       0    0    0    4    0     0    6
++67      4    0    3    0    0       0    0    0    0    0     0    2
++68      6    0   22    0    0       0    0    0    1    0     0    4
++
++***  quasiswap  ***
++--> margin both  shuffle samp <--
++grand sum: [1] TRUE
++row sums:  [1] TRUE
++col sums:  [1] TRUE
++fill:      [1] TRUE
++row freqs: [1] "Mean relative difference: 0.2614841"
++col freqs: [1] "Mean relative difference: 0.2735675"
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       0    3    5    2    0       0    0    0    0    5     0    2
++9       4    0   13    0    1       0    4    0    0    1     0    5
++11      9    4   21    0    0       0    3    0    5    0     0    0
++14     18    2   22    2    0       0    2    0    0   11     4    0
++15      0    0   15    0    0       0    0    0    0    0     0    0
++19      1    1    6    0    0       0   10    0    0    0     9    2
++25      0    3   10    0    1       0    3    0    0    5     0    3
++30     12    0   17    0    0       2    0    2    2    2     1    0
++32      1    0    0    0    0       0    0    1    0    3     0    0
++33     18    0    0    0    0       0    1    0    1    4     1    0
++34     16    0   18    0    1       0    4    1    3   11     0    3
++35      2    1    8    0    0       0    0    0    3    0     3   11
++36     14    0   22    0    0       0    0    0    0    9     0    0
++37      2    0   13    0    0       0    0    0    2   17     1    5
++38     16    1   11    1    0       0    4    0    0    0     2    0
++39      7    1    7    0    0       0    2    1    0   10     0    2
++40      5    1    0    0    0       0    0    0    0    5     0    9
++41      0    0   19    0    0       0    1    0    1    2     0    0
++42      6    0   16    0    0       0    3    0    0    4     3    0
++43      4    0   22    0    0       0    0    0    2    6     4    6
++44      0    0    9    0    0       0    6    0    0    3     3    0
++45      3    0    3    2    0       0    0    0    0   18     0    0
++46     14    2   22    1    0       0    0    0    5    2     3    6
++47      5    0    6    6    0       0    4    0    0    1     0    0
++48      4    0    5    0    0       0    0    0    0    9     3    0
++49     12    0    6    0    0       0    2    0    2    0     0    2
++50      0    0    7    0    0       0    0    0    0    0     0    0
++51      0    0    0    0    0       2    0    0    0    0     0    3
++52     18    0    0    1    0       1    6    0    0    7     0    1
++53      7    0   15    0    1       0    3    0    0    6     0    0
++54      0    0   10    0    0       0    1    0    0    0     0    1
++55      5    0    0    0    0       0    1    0    1    0     0    0
++56      0    0    1    0    0       0    2    0    0    0     6    0
++57      1    0    0    0    0       0    0    0    0    0     0    4
++58      1    1    2    0    0       1    0    0    0    6     0    2
++59      6    0    0    0    0       0    0    0    0    0     0    5
++60      5    1    0    0    0       0    0    0    1    8     0    0
++61      2    0    5    0    0       1    3    0    0    0     0    0
++62      0    0    0    0    0       0    0    0    0    0     0    4
++63      6    0    0    0    0       0   11    0    5    0     0    0
++64      4    1    0    0    0       1    0    0    0    0     5    0
++66      5    5    3    1    0       0    0    0    3    0     0    0
++67     52    0   72    0    0       1    9    1    2   23     5    0
++68     14    0   19    0    0       0    3    0    3    1     5    0
++
++***  quasiswap  ***
++--> margin both  shuffle both <--
++grand sum: [1] TRUE
++row sums:  [1] TRUE
++col sums:  [1] TRUE
++fill:      [1] TRUE
++row freqs: [1] "Mean relative difference: 0.2614841"
++col freqs: [1] "Mean relative difference: 0.2735675"
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       0    3    5    2    0       0    0    0    0    5     0    2
++9       4    0   13    0    1       0    4    0    0    1     0    5
++11      9    4   21    0    0       0    3    0    5    0     0    0
++14     18    2   22    2    0       0    2    0    0   11     4    0
++15      0    0   15    0    0       0    0    0    0    0     0    0
++19      1    1    6    0    0       0   10    0    0    0     9    2
++25      0    3   10    0    1       0    3    0    0    5     0    3
++30     12    0   17    0    0       2    0    2    2    2     1    0
++32      1    0    0    0    0       0    0    1    0    3     0    0
++33     18    0    0    0    0       0    1    0    1    4     1    0
++34     16    0   18    0    1       0    4    1    3   11     0    3
++35      2    1    8    0    0       0    0    0    3    0     3   11
++36     14    0   22    0    0       0    0    0    0    9     0    0
++37      2    0   13    0    0       0    0    0    2   17     1    5
++38     16    1   11    1    0       0    4    0    0    0     2    0
++39      7    1    7    0    0       0    2    1    0   10     0    2
++40      5    1    0    0    0       0    0    0    0    5     0    9
++41      0    0   19    0    0       0    1    0    1    2     0    0
++42      6    0   16    0    0       0    3    0    0    4     3    0
++43      4    0   22    0    0       0    0    0    2    6     4    6
++44      0    0    9    0    0       0    6    0    0    3     3    0
++45      3    0    3    2    0       0    0    0    0   18     0    0
++46     14    2   22    1    0       0    0    0    5    2     3    6
++47      5    0    6    6    0       0    4    0    0    1     0    0
++48      4    0    5    0    0       0    0    0    0    9     3    0
++49     12    0    6    0    0       0    2    0    2    0     0    2
++50      0    0    7    0    0       0    0    0    0    0     0    0
++51      0    0    0    0    0       2    0    0    0    0     0    3
++52     18    0    0    1    0       1    6    0    0    7     0    1
++53      7    0   15    0    1       0    3    0    0    6     0    0
++54      0    0   10    0    0       0    1    0    0    0     0    1
++55      5    0    0    0    0       0    1    0    1    0     0    0
++56      0    0    1    0    0       0    2    0    0    0     6    0
++57      1    0    0    0    0       0    0    0    0    0     0    4
++58      1    1    2    0    0       1    0    0    0    6     0    2
++59      6    0    0    0    0       0    0    0    0    0     0    5
++60      5    1    0    0    0       0    0    0    1    8     0    0
++61      2    0    5    0    0       1    3    0    0    0     0    0
++62      0    0    0    0    0       0    0    0    0    0     0    4
++63      6    0    0    0    0       0   11    0    5    0     0    0
++64      4    1    0    0    0       1    0    0    0    0     5    0
++66      5    5    3    1    0       0    0    0    3    0     0    0
++67     52    0   72    0    0       1    9    1    2   23     5    0
++68     14    0   19    0    0       0    3    0    3    1     5    0
++
++***  swsh  ***
++--> margin rows  shuffle samp <--
++grand sum: [1] TRUE
++row sums:  [1] TRUE
++col sums:  [1] "Mean relative difference: 0.7988952"
++fill:      [1] TRUE
++row freqs: [1] TRUE
++col freqs: [1] TRUE
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       8    0    2    0    6       4    0    0    0    0     3    1
++9      30    0    1    3    0       3    7    0    0    0     0    3
++11      1    0    6    2    0       0    7   17    7    1     0   42
++14      2    8    2    0    0       0    0    0   61    1     5    3
++15      1    0    2    0    0       0    0    0    1    1     0   29
++19      1    5    2    0    0       0    0    2    0   16    10    0
++25      2    0    1    0    0       1    0    0   12    5     0    0
++30      2    0    1    0    0       0    0    1   12    0     2    1
++32      5    4    2    0    0       0    0    0    5    0     0    9
++33      1    1   15    0    0       0    0    0    0    0     0   38
++34      9    0    1    1    0       5    2    0    4   22     1    4
++35     21    4    3    0    0       0    0    0    0   26     1    6
++36     20    0    2    0   12       1    4    3    0    0     0    1
++37      1    3    1    0    2       0    0    0    0    0     0   21
++38      1    0    4    0    0       1    2    0    0    0     0    6
++39      1    0    2    0    0       0    1    0    0    0     0   18
++40      6    0   26    0    0       0    1    0    1    0     0    0
++41      0    1   13    0    0       0    0    0    0    0     0    5
++42      1    0   12    0    0       1    0    0    0    0     0    0
++43     14    0    5    0    0       0    1    0    3    1     0    0
++44      0    0   28    0    0       0    0    0    0    0     0   24
++45     52    0    1    0    0       0   11    0    0    0     0    0
++46      2    0    3    0    0       0    0    1   42    4     0    0
++47      0    0    1    0    0       0   20    0    0    0     0    1
++48      6    0   29    0    0       0    0    0    0    0     0    0
++49     10    0    7    0    0       0   17    0    0    0     0    0
++50      8    0    3    0    0       0    0    0    0    0     0    9
++51      1    0    4    0    0       0    0    0    0    0     0    0
++52      5    0    9    0    0       0    0    0    0    1     0    0
++53      9    0    5    0    0       0    9    0    0    2    44   17
++54      1    0   21    0    0       0    0    0    0    1     0    0
++55      0    0    5    0    0       0   15    0    0    5     0    2
++56     17    0   16    0    0       0    0    0    0    0     0    3
++57      0    0    2    0    0       0    0    0    0    0     0    0
++58      0    0   12    0    0       0    1    0    0    2     0    0
++59      2    0    0    0    0       0    1    0    0    0     0    0
++60      2    0    0    0    0       0    0    0    1    0     0   55
++61      6    0    1    6    0       0    0    0    0    2     0    3
++62      1    0    0    0    0       0    0    0    5    0     0    0
++63      2    2    8    0    0       0    5    0    3   14     0   13
++64      4    0    0    0    0       0    1    0    3    0     0   16
++66     25    0    6    8    0       0    4    0    3    3     4    9
++67      0    0    3    0    0       0    0    0    0    0     0    0
++68     17    0    3    0    0       0    0    0    3    0     4    3
++
++***  swsh  ***
++--> margin rows  shuffle both <--
++grand sum: [1] TRUE
++row sums:  [1] TRUE
++col sums:  [1] "Mean relative difference: 0.6956672"
++fill:      [1] TRUE
++row freqs: [1] TRUE
++col freqs: [1] TRUE
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       4    0    9    0   13       5    0    0    0    0     5    5
++9       7    0    9   10    0       5    4    0    0    0     0    5
++11      9    0    9   10    0       0    9    8    5    8     0    8
++14     15   15    8    0    0       0    0    0   13   15     8   11
++15      5    0    7    0    0       0    0    0    3    5     0    4
++19      7    8    6    0    0       0    0    5    0    5     7    0
++25     10    0    3    0    0       6    0    0    8    9     0    0
++30      1    0    5    0    0       0    0    5    5    0     7    7
++32      4    6    7    0    0       0    0    0    5    0     0    7
++33      4    6   11    0    0       0    0    0    0    0     0   10
++34      8    0   11   12    0      10    9    0    9    8    15    7
++35      6    5    7    0    0       0    0    0    0    5     7    3
++36      5    0    7    0   11       9    5    9    0    0     0    3
++37     13   12    8    0    8       0    0    0    0    0     0    7
++38     14    0   14    0    0      15   11    0    0    0     0   14
++39      7    0    9    0    0       0    7    0    0    0     0   11
++40     13    0   15    0    0       0    7    0   11    0     0    0
++41      0    9    5    0    0       0    0    0    0    0     0    5
++42     12    0   17    0    0      13    0    0    0    0     0    0
++43     10    0   14    0    0       0   12    0   17   16     0    0
++44      0    0   17    0    0       0    0    0    0    0     0   11
++45      9    0   11    0    0       0    8    0    0    0     0    0
++46     12    0   10    0    0       0    0    4   10   15     0    0
++47      0    0    7    0    0       0   10    0    0    0     0    8
++48      6    0   12    0    0       0    0    0    0    0     0    0
++49      7    0    7    0    0       0   11    0    0    0     0    0
++50     16    0   17    0    0       0    0    0    0    0     0   16
++51      6    0    7    0    0       0    0    0    0    0     0    0
++52     11    0    7    0    0       0    0    0    0    6     0    0
++53      6    0    8    0    0       0    8    0    0   11    11   12
++54      9    0    2    0    0       0    0    0    0    8     0    0
++55      0    0    7    0    0       0    6    0    0    6     0    5
++56     14    0    8    0    0       0    0    0    0    0     0   14
++57      0    0    1    0    0       0    0    0    0    0     0    0
++58      0    0   12    0    0       0   11    0    0   11     0    0
++59     11    0    0    0    0       0   16    0    0    0     0    0
++60     12    0    0    0    0       0    0    0   11    0     0    9
++61      6    0    4    7    0       0    0    0    0    7     0    4
++62      2    0    0    0    0       0    0    0    1    0     0    0
++63      5    5    6    0    0       0    6    0    2    6     0    4
++64      7    0    0    0    0       0    9    0    7    0     0    4
++66      3    0   15    9    0       0   11    0    6    5     8    9
++67      0    0  112    0    0       0    0    0    0    0     0    0
++68      5    0    9    0    0       0    0    0   11    0     8   13
++
++***  swsh  ***
++--> margin columns  shuffle samp <--
++grand sum: [1] TRUE
++row sums:  [1] "Mean relative difference: 0.6253322"
++col sums:  [1] TRUE
++fill:      [1] TRUE
++row freqs: [1] TRUE
++col freqs: [1] TRUE
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8      12    0   16    0    2       2    0    0    0    0     3    3
++9       3    0   31    2    0       1    1    0    0    0     0    5
++11      8    0    3    9    0       0    2    1    1    1     0    1
++14      2    4    3    0    0       0    0    0    4    1     5    4
++15      3    0    3    0    0       0    0    0    2   18     0    2
++19      8    5    8    0    0       0    0    1    0    2     5    0
++25      3    0   22    0    0       1    0    0    1   24     0    0
++30      4    0   17    0    0       0    0    1    1    0     6    2
++32      5    1   35    0    0       0    0    0    2    0     0    9
++33      4    4    2    0    0       0    0    0    0    0     0    1
++34      6    0   12    1    0       1    5    0    2    3    20    2
++35     36    3   14    0    0       0    0    0    0   26     4    1
++36      1    0    7    0    1       2    2    1    0    0     0    6
++37      3    1    9    0    1       0    0    0    0    0     0    1
++38      6    0    3    0    0       1    7    0    0    0     0    1
++39     41    0    5    0    0       0    3    0    0    0     0    1
++40      4    0   12    0    0       0    4    0    1    0     0    0
++41      0    7   10    0    0       0    0    0    0    0     0    2
++42      1    0    8    0    0       1    0    0    0    0     0    0
++43     19    0    4    0    0       0    1    0    4   36     0    0
++44      0    0   16    0    0       0    0    0    0    0     0    7
++45      5    0    4    0    0       0   12    0    0    0     0    0
++46     20    0   16    0    0       0    0    2    3    1     0    0
++47      0    0    2    0    0       0    5    0    0    0     0    1
++48      3    0    6    0    0       0    0    0    0    0     0    0
++49      1    0    5    0    0       0    1    0    0    0     0    0
++50      3    0   15    0    0       0    0    0    0    0     0    4
++51      5    0    2    0    0       0    0    0    0    0     0    0
++52      2    0   18    0    0       0    0    0    0   20     0    0
++53      3    0    5    0    0       0    2    0    0    1     4   10
++54      6    0   10    0    0       0    0    0    0   12     0    0
++55      0    0   37    0    0       0    2    0    0    1     0    2
++56      2    0   17    0    0       0    0    0    0    0     0    1
++57      0    0   14    0    0       0    0    0    0    0     0    0
++58      0    0    8    0    0       0   15    0    0   16     0    0
++59     12    0    0    0    0       0    2    0    0    0     0    0
++60      1    0    0    0    0       0    0    0    3    0     0    1
++61     38    0    2    2    0       0    0    0    0   11     0    3
++62     10    0    0    0    0       0    0    0    7    0     0    0
++63     11    2   12    0    0       0   16    0    2    5     0    2
++64      3    0    0    0    0       0    3    0    2    0     0    1
++66      4    0    9    2    0       0    5    0    3    1     9    1
++67      0    0    2    0    0       0    0    0    0    0     0    0
++68      1    0    6    0    0       0    0    0    3    0     2    2
++
++***  swsh  ***
++--> margin columns  shuffle both <--
++grand sum: [1] TRUE
++row sums:  [1] "Mean relative difference: 0.3829337"
++col sums:  [1] TRUE
++fill:      [1] TRUE
++row freqs: [1] TRUE
++col freqs: [1] TRUE
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       5    0   14    0    2       1    0    0    0    0     7    1
++9      11    0   10    4    0       1    4    0    0    0     0    1
++11     16    0   15    2    0       0    5    1    2   11     0    1
++14      8    3    9    0    0       0    0    0    5    8     9    2
++15      7    0    9    0    0       0    0    0    2    8     0    3
++19      7    4   13    0    0       0    0    1    0    6     7    0
++25      7    0   19    0    0       1    0    0    3   16     0    0
++30      9    0    5    0    0       0    0    1    4    0     7    4
++32      7    3   14    0    0       0    0    0    1    0     0    2
++33      8    3    9    0    0       0    0    0    0    0     0    4
++34      5    0    6    3    0       2    5    0    2    9     2    1
++35      5    2    6    0    0       0    0    0    0    9     5    3
++36      6    0    7    0    1       1    4    2    0    0     0    3
++37     14    4   14    0    1       0    0    0    0    0     0    2
++38      9    0   14    0    0       1    4    0    0    0     0    2
++39      5    0    7    0    0       0    6    0    0    0     0    5
++40      7    0   14    0    0       0    7    0    3    0     0    0
++41      0    4   14    0    0       0    0    0    0    0     0    2
++42     10    0    7    0    0       2    0    0    0    0     0    0
++43      9    0   12    0    0       0    5    0    3    6     0    0
++44      0    0   14    0    0       0    0    0    0    0     0    2
++45     13    0    8    0    0       0    5    0    0    0     0    0
++46      7    0   10    0    0       0    0    1    3   12     0    0
++47      0    0    8    0    0       0    4    0    0    0     0    2
++48      9    0    7    0    0       0    0    0    0    0     0    0
++49     10    0   10    0    0       0    7    0    0    0     0    0
++50      5    0    9    0    0       0    0    0    0    0     0    3
++51      4    0    4    0    0       0    0    0    0    0     0    0
++52      5    0   12    0    0       0    0    0    0   12     0    0
++53      9    0    8    0    0       0    4    0    0   13     7    1
++54      8    0    7    0    0       0    0    0    0   15     0    0
++55      0    0    9    0    0       0    7    0    0   15     0    2
++56      7    0   14    0    0       0    0    0    0    0     0    5
++57      0    0   13    0    0       0    0    0    0    0     0    0
++58      0    0   11    0    0       0    4    0    0   12     0    0
++59     11    0    0    0    0       0    4    0    0    0     0    0
++60     11    0    0    0    0       0    0    0    4    0     0    5
++61     10    0   11    3    0       0    0    0    0    6     0    4
++62      7    0    0    0    0       0    0    0    1    0     0    0
++63      6    4   19    0    0       0    3    0    1   13     0    2
++64      9    0    0    0    0       0    4    0    1    0     0    6
++66      7    0   14    4    0       0    6    0    4    8     8    3
++67      0    0   12    0    0       0    0    0    0    0     0    0
++68      6    0   12    0    0       0    0    0    2    0     6    5
++
++***  abuswap  ***
++--> margin rows  shuffle samp <--
++grand sum: [1] TRUE
++row sums:  [1] TRUE
++col sums:  [1] "Mean relative difference: 0.2473584"
++fill:      [1] TRUE
++row freqs: [1] TRUE
++col freqs: [1] TRUE
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       5    4    8    2    1       2    0    0   10    1     4    0
++9       3    3    2    2    0       1   12    0    0    0     3    0
++11     36   17   35    9    0       2    5    0    6    1     0    1
++14     41    5    2    0    2       0    3    0    0   24    20   20
++15      0    0    6    0    0       0    1    0    0   29     5    0
++19     12    2    1    1    0       0    4    0    0   16     0    2
++25     12    5    2    0    0       1    1    1    2    1     2    1
++30      1    1    2    0    0       0    7    1    0    0     0   20
++32      4    0    9    0    0       0    5    0    0    5     0    4
++33     38    0    2    0    0       0    0    0    0    1     1    0
++34      5    0   14    0    0       0    1    0    1   11     4    2
++35      1    0    2    0    0       1   29    2    3    0     3   26
++36      3    1    2    0    0       1    4    0    0    0     0    0
++37      3    0    5    0    0       0    2    0    0   36     0    0
++38      8    0    6    0    0       0   15    2    4    0     0    0
++39      0    0    0    0    0       0    0    0    0    0     0   40
++40      1    0    1    0    0       0    0    0    1    3     0    0
++41      1    0   10    0    0       0    0    0    0    0     0    0
++42      0    0   12    0    0       0    0    0    0    0     0    1
++43      5    0    2    0    0       0   16    0    0    0     0    1
++44      0    0    0    0    0       0    1    0    0    0     0    0
++45      6    0    8    0    0       0    0    0    0   52     0    4
++46      4    0    4    0    0       0    2    0    1   12     0    2
++47      0    0   24    0    0       0    0    0   18    0     0    1
++48      0    0    3    0    0       0    0    0    0    6     0    0
++49     10    0   14    0    0       0   25    0    0    1     0    7
++50      4    0    3   37    0       0    9    0    2    0     0    1
++51      2    0    5    0    0       3    0    0    0    0     1    8
++52      1    0    4    0    0       0    0    0    2    0     0    0
++53      3    0    2    0    0       0    0   17    2    0     0    1
++54      2    0    7    0    0       0    0    0    0    0     0    1
++55      6    0    3    0    0       0    0    0    0    0     0    5
++56      1    0   16    0    0       0    0    0    0    0     0    0
++57      0    0    0    0    0       0    0    0    0    0     0    0
++58      1    0   12    0    0       0    0    0    0    2     0    4
++59      1    0    0    0    0       0    0    0    0    0     0    2
++60      1    0   55    0    0       0    0    0    7    0     0    0
++61      6    0    9    0    0       0    0    0    0    0     0    0
++62      3    0    5    0    0       0    0    0    0    0     0    1
++63     19    0   13    0    0       0    0    0    2    0     0    2
++64      3    0   11    0    0       0    0    0    0    3     0    3
++66      4    0    8    0    3       0    0    0    4    0     0   18
++67      4    0    3    0    0       0    0    0    0    0     0    0
++68      6    0   32    0    0       0    0    0    3    0     0    4
++
++***  abuswap  ***
++--> margin rows  shuffle both <--
++grand sum: [1] TRUE
++row sums:  [1] TRUE
++col sums:  [1] "Mean relative difference: 0.2473584"
++fill:      [1] TRUE
++row freqs: [1] TRUE
++col freqs: [1] TRUE
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       5    4    8    2    1       2    0    0   10    1     4    0
++9       3    3    2    2    0       1   12    0    0    0     3    0
++11     36   17   35    9    0       2    5    0    6    1     0    1
++14     41    5    2    0    2       0    3    0    0   24    20   20
++15      0    0    6    0    0       0    1    0    0   29     5    0
++19     12    2    1    1    0       0    4    0    0   16     0    2
++25     12    5    2    0    0       1    1    1    2    1     2    1
++30      1    1    2    0    0       0    7    1    0    0     0   20
++32      4    0    9    0    0       0    5    0    0    5     0    4
++33     38    0    2    0    0       0    0    0    0    1     1    0
++34      5    0   14    0    0       0    1    0    1   11     4    2
++35      1    0    2    0    0       1   29    2    3    0     3   26
++36      3    1    2    0    0       1    4    0    0    0     0    0
++37      3    0    5    0    0       0    2    0    0   36     0    0
++38      8    0    6    0    0       0   15    2    4    0     0    0
++39      0    0    0    0    0       0    0    0    0    0     0   40
++40      1    0    1    0    0       0    0    0    1    3     0    0
++41      1    0   10    0    0       0    0    0    0    0     0    0
++42      0    0   12    0    0       0    0    0    0    0     0    1
++43      5    0    2    0    0       0   16    0    0    0     0    1
++44      0    0    0    0    0       0    1    0    0    0     0    0
++45      6    0    8    0    0       0    0    0    0   52     0    4
++46      4    0    4    0    0       0    2    0    1   12     0    2
++47      0    0   24    0    0       0    0    0   18    0     0    1
++48      0    0    3    0    0       0    0    0    0    6     0    0
++49     10    0   14    0    0       0   25    0    0    1     0    7
++50      4    0    3   37    0       0    9    0    2    0     0    1
++51      2    0    5    0    0       3    0    0    0    0     1    8
++52      1    0    4    0    0       0    0    0    2    0     0    0
++53      3    0    2    0    0       0    0   17    2    0     0    1
++54      2    0    7    0    0       0    0    0    0    0     0    1
++55      6    0    3    0    0       0    0    0    0    0     0    5
++56      1    0   16    0    0       0    0    0    0    0     0    0
++57      0    0    0    0    0       0    0    0    0    0     0    0
++58      1    0   12    0    0       0    0    0    0    2     0    4
++59      1    0    0    0    0       0    0    0    0    0     0    2
++60      1    0   55    0    0       0    0    0    7    0     0    0
++61      6    0    9    0    0       0    0    0    0    0     0    0
++62      3    0    5    0    0       0    0    0    0    0     0    1
++63     19    0   13    0    0       0    0    0    2    0     0    2
++64      3    0   11    0    0       0    0    0    0    3     0    3
++66      4    0    8    0    3       0    0    0    4    0     0   18
++67      4    0    3    0    0       0    0    0    0    0     0    0
++68      6    0   32    0    0       0    0    0    3    0     0    4
++
++***  abuswap  ***
++--> margin columns  shuffle samp <--
++grand sum: [1] TRUE
++row sums:  [1] "Mean relative difference: 0.2329697"
++col sums:  [1] TRUE
++fill:      [1] TRUE
++row freqs: [1] TRUE
++col freqs: [1] TRUE
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       5    4    8    2    1       2    0    0    1    1     4    0
++9       3    3    2    2    0       1   12    0    0    0     3    0
++11     36    4   35    9    0       2    5    0    3   20     0    1
++14     41    5   10    0    2       0    1    0    0   24    20    1
++15      0    0   18    0    0       0    3    0    0    1     5    0
++19     12    2   12    1    0       0    4    0    0   16     0    2
++25     12    7   17    0    0       1    2    1    1    1     2    1
++30      4    1    2    0    0       0    7    1    0    0     0    2
++32      1    0    9    0    0       0    5    0    0    5     0    1
++33     38    0   15    0    0       0    0    0    0    1     6    0
++34      5    0   14    0    0       0    1    0    1   11     4    2
++35     11    0    3    0    0       1    2    2    2    0     9    3
++36      3    1    2    0    0       1    2    0    0    0     0    0
++37      3    0    5    0    0       0    2    0    0   36     0    0
++38      3    0    6    0    0       0   15    1    4    0     0    0
++39      0    0    0    0    0       0    0    0    0    0     0    6
++40      1    0    2    0    0       0    0    0    3    3     0    0
++41      3    0   10    0    0       0    0    0    0    0     0    0
++42      0    0   12    0    0       0    0    0    0    0     0    1
++43      5    0    2    0    0       0   16    0    0    0     0    2
++44      0    0    0    0    0       0    3    0    0    0     0    0
++45      8    0    8    0    0       0    0    0    0   26     0    4
++46      4    0    4    0    0       0    2    0    1   12     0    2
++47      0    0   16    0    0       0    0    0    3    0     0    1
++48      0    0    3    0    0       0    0    0    0    1     0    0
++49     10    0   14    0    0       0    1    0    0    1     0    7
++50      4    0   17    2    0       0    5    0    2    0     0    1
++51      2    0    5    0    0       1    0    0    0    0     5    1
++52      2    0    4    0    0       0    0    0    2    0     0    0
++53      3    0   37    0    0       0    0    1    2    0     0    1
++54      2    0    7    0    0       0    0    0    0    0     0    2
++55     20    0    3    0    0       0    0    0    0    0     0    5
++56      1    0   16    0    0       0    0    0    0    0     0    0
++57      0    0    0    0    0       0    0    0    0    0     0    0
++58      6    0   12    0    0       0    0    0    0    2     0    1
++59      1    0    0    0    0       0    0    0    0    0     0    1
++60      1    0   22    0    0       0    0    0    7    0     0    0
++61      6    0    9    0    0       0    0    0    0    0     0    0
++62      3    0    5    0    0       0    0    0    0    0     0   10
++63     19    0   31    0    0       0    0    0    2    0     0    2
++64      3    0    8    0    0       0    0    0    0   18     0    3
++66      8    0    6    0    1       0    0    0    4    0     0    9
++67      4    0    3    0    0       0    0    0    0    0     0    0
++68      6    0   16    0    0       0    0    0    3    0     0    4
++
++***  abuswap  ***
++--> margin columns  shuffle both <--
++grand sum: [1] TRUE
++row sums:  [1] "Mean relative difference: 0.2329697"
++col sums:  [1] TRUE
++fill:      [1] TRUE
++row freqs: [1] TRUE
++col freqs: [1] TRUE
++   Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
++8       5    4    8    2    1       2    0    0    1    1     4    0
++9       3    3    2    2    0       1   12    0    0    0     3    0
++11     36    4   35    9    0       2    5    0    3   20     0    1
++14     41    5   10    0    2       0    1    0    0   24    20    1
++15      0    0   18    0    0       0    3    0    0    1     5    0
++19     12    2   12    1    0       0    4    0    0   16     0    2
++25     12    7   17    0    0       1    2    1    1    1     2    1
++30      4    1    2    0    0       0    7    1    0    0     0    2
++32      1    0    9    0    0       0    5    0    0    5     0    1
++33     38    0   15    0    0       0    0    0    0    1     6    0
++34      5    0   14    0    0       0    1    0    1   11     4    2
++35     11    0    3    0    0       1    2    2    2    0     9    3
++36      3    1    2    0    0       1    2    0    0    0     0    0
++37      3    0    5    0    0       0    2    0    0   36     0    0
++38      3    0    6    0    0       0   15    1    4    0     0    0
++39      0    0    0    0    0       0    0    0    0    0     0    6
++40      1    0    2    0    0       0    0    0    3    3     0    0
++41      3    0   10    0    0       0    0    0    0    0     0    0
++42      0    0   12    0    0       0    0    0    0    0     0    1
++43      5    0    2    0    0       0   16    0    0    0     0    2
++44      0    0    0    0    0       0    3    0    0    0     0    0
++45      8    0    8    0    0       0    0    0    0   26     0    4
++46      4    0    4    0    0       0    2    0    1   12     0    2
++47      0    0   16    0    0       0    0    0    3    0     0    1
++48      0    0    3    0    0       0    0    0    0    1     0    0
++49     10    0   14    0    0       0    1    0    0    1     0    7
++50      4    0   17    2    0       0    5    0    2    0     0    1
++51      2    0    5    0    0       1    0    0    0    0     5    1
++52      2    0    4    0    0       0    0    0    2    0     0    0
++53      3    0   37    0    0       0    0    1    2    0     0    1
++54      2    0    7    0    0       0    0    0    0    0     0    2
++55     20    0    3    0    0       0    0    0    0    0     0    5
++56      1    0   16    0    0       0    0    0    0    0     0    0
++57      0    0    0    0    0       0    0    0    0    0     0    0
++58      6    0   12    0    0       0    0    0    0    2     0    1
++59      1    0    0    0    0       0    0    0    0    0     0    1
++60      1    0   22    0    0       0    0    0    7    0     0    0
++61      6    0    9    0    0       0    0    0    0    0     0    0
++62      3    0    5    0    0       0    0    0    0    0     0   10
++63     19    0   31    0    0       0    0    0    2    0     0    2
++64      3    0    8    0    0       0    0    0    0   18     0    3
++66      8    0    6    0    1       0    0    0    4    0     0    9
++67      4    0    3    0    0       0    0    0    0    0     0    0
++68      6    0   16    0    0       0    0    0    3    0     0    4
++Warning messages:
++1: In permatswap(x, method = method, fixedmar = margin, shuffle = what,  :
++  quantitative swap method may not yield random null models, use only to study its properties
++2: In permatswap(x, method = method, fixedmar = margin, shuffle = what,  :
++  quantitative swap method may not yield random null models, use only to study its properties
++> ### end permatswap
++> 
++> nm=nullmodel(m,"abuswap_c")
++> sm<-simulate(nm,nsim=100,thin=100,burnin=100)
++> 
++> ### clean
++> rm(list = ls())
++> 
++> ## end permatfull/swap
++> 
++> ## The following vegan functions depend on *oecosimu*: adipart
++> ## hiersimu multipart raupcrick. The following functions directly
++> ## depend on *commsimulator*: permatfull1 permatswap1.  All these have
++> ## derived and/or method functions. These should not be broken.
++> 
++> ## Do not break raupcrick:
++> set.seed(4711)
++> data(sipoo)
++> as.numeric(raupcrick(sipoo, nsimul = 99))
++  [1] 0.09 0.03 0.29 0.02 0.63 0.48 0.15 0.70 0.76 0.64 0.10 0.20 0.26 0.79 0.80
++ [16] 0.87 0.90 0.02 0.37 0.04 0.03 0.44 0.16 0.26 0.36 0.25 0.15 0.22 0.30 0.47
++ [31] 0.85 0.46 0.57 0.40 0.02 0.26 0.62 0.06 0.71 0.82 0.35 0.06 0.13 0.02 0.59
++ [46] 0.63 0.32 0.93 0.04 0.06 0.05 0.17 0.05 0.11 0.20 0.13 0.14 0.67 0.34 0.33
++ [61] 0.63 0.79 0.02 0.06 0.16 0.44 0.18 0.06 0.01 0.01 0.09 0.15 0.18 0.29 0.40
++ [76] 0.08 0.12 0.01 0.01 0.01 0.08 0.04 0.58 0.02 0.10 0.26 0.37 0.53 0.23 0.11
++ [91] 0.26 0.15 0.16 0.68 0.37 0.35 0.85 0.53 0.01 0.29 0.05 0.10 0.16 0.25 0.39
++[106] 0.79 0.37 0.98 0.02 0.04 0.12 0.04 0.91 0.02 0.12 0.27 0.38 0.07 0.31 0.43
++[121] 0.60 0.34 0.74 0.80 0.99 0.19 0.15 0.60 0.18 0.37 0.69 0.97 0.01 0.07 0.18
++[136] 0.20 0.08 0.55 0.27 0.01 0.01 0.25 0.18 0.63 0.65 0.61 1.00 0.09 0.49 0.15
++[151] 0.15 0.48 0.90
++> rm(list = ls())
++> ## end raupcrick
++> 
++> 
++> 
++> proc.time()
++   user  system elapsed 
++  2.046   0.106   2.142 
+diff --git a/tests/vegan-tests.R b/tests/vegan-tests.R
+new file mode 100644
+index 0000000..74f8ea2
+--- /dev/null
++++ b/tests/vegan-tests.R
+@@ -0,0 +1,262 @@
++### vegan-tests: unit tests for vegan functions
++
++### This file contains unit tests for vegan functions. This file is
++### run in R CMD check and its results are compared against previously
++### saved results in vegan-tests.Rout.save. If you change tests, you
++### must generate new vegan-tests.Rout.save in this directory.
++
++### The current plan is that tests/ are not included in the CRAN
++### release, but only in the development versin of vegan in R-Forge.
++
++### The tests here are not intended for human reading. The tests need
++### not be ecological or biologically meaningful, but they are only
++### intended for testing strange arguments, protect against
++### regressions and test correctness of results.
++
++### The tests are in a single file and you should clean work space
++### after the unit test. You should set random number seed (if needed)
++### for comparison against vegan-tests.Rout.save, and you should
++### remove the seed after the unit test. If possible, avoid very long
++### lasting tests.
++
++###<--- BEGIN TESTS --->
++suppressPackageStartupMessages(require(vegan))
++###<--- BEGIN anova.cca test --->
++### anova.cca tests: should work with (1) subset, (2) missing values,
++### (3) with functions of variables poly(A1,2), (4) variables in data
++### frame attached or in data=, or (5) in working environment
++set.seed(4711)
++data(dune)
++data(dune.env)
++df <- dune.env
++df$Management[c(1,5)] <- NA
++## formula
++fla <- as.formula("dune ~ Management + poly(A1, 2) + spno")
++### variable in the .GlobalEnv
++spno <- specnumber(dune)
++### data= argument
++## cca/rda
++m <-  cca(fla, data=df,  na.action=na.exclude,  subset = Use != "Pasture" & spno > 7)
++anova(m, permutations=99)
++## vegan 2.1-40 cannot handle missing data in next two
++##anova(m, by="term", permutations=99)
++##anova(m, by="margin", permutations=99)
++anova(m, by="axis", permutations=99)
++## capscale
++p <- capscale(fla, data=df, na.action=na.exclude, subset = Use != "Pasture" & spno > 7)
++anova(p, permutations=99)
++## vegan 2.1-40 cannot handle missing data in next two
++##anova(p, by="term", permutations=99)
++##anova(p, by="margin", permutations=99)
++anova(p, by="axis", permutations=99)
++## see that capscale can be updated and also works with 'dist' input
++dis <- vegdist(dune)
++p <- update(p, dis ~ .)
++anova(p, permutations=99)
++## vegan 2.1-40 cannot handle missing data in next two
++##anova(p, by="term", permutations=99)
++##anova(p, by="margin", permutations=99)
++anova(p, by="axis", permutations=99)
++### attach()ed data frame instead of data=
++attach(df)
++q <- cca(fla, na.action = na.omit, subset = Use != "Pasture" & spno > 7)
++anova(q, permutations=99)
++## commented tests below fail in vegan 2.1-40 because number of
++## observations changes
++##anova(q, by="term", permutations=99) 
++##anova(q, by="margin", permutations=99)
++anova(q, by="axis", permutations=99)
++### Check that constrained ordination functions can be embedded.
++### The data.frame 'df' is still attach()ed.
++foo <- function(bar, Y, X, ...)
++{
++    bar <- match.fun(bar)
++    bar(Y ~ X, ...)
++}
++foo("cca", dune, Management, na.action = na.omit)
++foo("rda", dune, Management, na.action = na.omit)
++foo("capscale", dune, Management, dist="jaccard", na.action = na.omit)
++foo("capscale", vegdist(dune), Management, na.action = na.omit)
++foo("capscale", dune, Management, na.action = na.omit) ## fails in 2.2-1
++###
++detach(df)
++### Check that statistics match in partial constrained ordination
++m <- cca(dune ~ A1 + Moisture + Condition(Management), dune.env, subset = A1 > 3)
++tab <- anova(m, by = "axis", permutations = 99)
++m
++tab
++all.equal(tab[,2], c(m$CCA$eig, m$CA$tot.chi), check.attributes=FALSE)
++tab[nrow(tab),1] == m$CA$rank
++## clean-up
++rm(df, spno, fla, m, p, q, tab, dis, foo, .Random.seed)
++### <--- END anova.cca test --->
++
++### Sven Neulinger <sneulinger@ifam.uni-kiel.de> reported failures in
++### partial analysis which (mostly) were fixed in r2087. Below his test.
++
++set.seed(4711)
++X <- matrix(rnorm(30*6), 30, 6)
++
++A <- factor(rep(rep(c("a","b"), each=3),5))
++B <- factor(rep(c("a","b","c"), 10))
++## Sven Neulinger's tests failed still in 2.2-1, now due to look-up
++## order: function stats::C was found before matrix 'C'. The test was
++## OK when non-function name was used ('CC').
++C <- factor(rep(c(1:5), each=6))
++
++## partial db-RDA
++cap.model.cond <- capscale(X ~ A + B + Condition(C))
++anova(cap.model.cond, by="axis", strata=C)  # -> error pre r2287
++anova(cap.model.cond, by="terms", strata=C)  # -> error pre r2287
++
++## db-RDA without conditional factor
++cap.model <- capscale(X ~ A + B)
++anova(cap.model, by="axis", strata=C)  # -> no error
++anova(cap.model, by="terms", strata=C)  # -> no error
++
++# partial RDA
++rda.model.cond <- rda(X ~ A + B + Condition(C))
++anova(rda.model.cond, by="axis", strata=C)  # -> no error
++anova(rda.model.cond, by="terms", strata=C)  # -> error pre r2287
++
++# RDA without conditional factor
++rda.model <- rda(X ~ A + B)
++anova(rda.model, by="axis", strata=C)  # -> no error
++anova(rda.model, by="terms", strata=C)  # -> no error
++## clean.up
++rm(X, A, B, C, cap.model.cond, cap.model, rda.model.cond, rda.model)
++### end Sven Neulinger's tests
++
++### Benedicte Bachelot informed us that several anova.cca* functions
++### failed if community data name was the same as a function name: the
++### function name was found first, and used instead ofa data. This
++### seems to be related to the same problem that Sven Neulinger
++### communicated, and his examples still faile if Condition or strata
++### are function names. However, the following examples that failed
++### should work now:
++
++set.seed(4711)
++cca <- dune
++m <- cca(cca ~ ., dune.env)
++anova(m, by="term")
++m <- capscale(cca ~ ., dune.env)
++anova(m, by="term")
++rm(m, cca)
++
++### end Benedicte Bachelot tests
++
++### Richard Telford tweeted this example on 23/2/2015. Fails in 2.2-1,
++### but should work now. Also issue #100 in github.com/vegandevs/vegan.
++set.seed(4711)
++data(dune, dune.env)
++foo <- function(x, env) {
++    m <- rda(x ~ Manure + A1, data = env)
++    anova(m, by = "margin")
++}
++out <- lapply(dune, foo, env = dune.env)
++out$Poatriv
++rm(foo, out)
++### end Richard Telford test
++
++
++### nestednodf: test case by Daniel Spitale in a comment to News on
++### the release of vegan 1.17-6 in vegan.r-forge.r-project.org.
++x <- c(1,0,1,1,1,1,1,1,0,0,0,1,1,1,0,1,1,0,0,0,1,1,0,0,0)
++m1 <- matrix(x, nrow=5, ncol=5, byrow=FALSE)# as in Fig 2 Almeida-Neto et al 2008.
++(nodf1 <- nestednodf(m1, order = FALSE, weighted = FALSE))
++## Now the same matrix but with abundance data
++x <- c(5,0,2,1,1,4,1,1,0,0,0,7,1,1,0,3,1,0,0,0,9,1,0,0,0)
++m <- matrix(x, nrow=5, ncol=5, byrow=FALSE)
++(nodfq <- nestednodf(m, order = FALSE, weighted = FALSE))
++identical(nodf1, nodfq)
++rm(x, m, m1, nodfq, nodf1)
++### end nestednodf
++
++### envfit & plot.envfit: latter failed if na.action resulted in only
++### observation with a given factor level was removed. plot.envfit would
++### fail with error about too long subscript
++### fixed case where data presented to envfit also has extraneous levels
++data(dune)
++data(dune.env)
++## add a new level to one of the factors
++levels(dune.env$Management) <- c(levels(dune.env$Management), "foo")
++## fit nMDS and envfit
++set.seed(1)
++mod <- metaMDS(dune)
++ef <- envfit(mod, dune.env, permutations = 99)
++plot(mod)
++plot(ef, p.max = 0.1)
++rm(mod, ef)
++### end envfit & plot.envfit
++
++### protest (& Procrustes analysis): Stability of the permutations and
++### other results.
++data(mite)
++mod <- rda(mite)
++x <- scores(mod, display = "si", choices=1:6)
++set.seed(4711)
++xp <- x[sample(nrow(x)),]
++pro <- protest(x, xp, permutations = how(nperm = 99))
++pro
++pro$t
++rm(x, xp, pro)
++### end protest
++
++### Check that functions related to predict.rda work correctly for all
++### constrained ordination methods.
++
++### simulate.rda/cca/capscale: based on predict.* and the following
++### should get back the data
++data(dune, dune.env)
++ind <- seq_len(nrow(dune))
++target <- as.matrix(dune)
++## rda
++mod <- rda(dune ~ Condition(Moisture) + Management + A1, dune.env)
++dat <- simulate(mod, indx = ind)
++all.equal(dat, target, check.attributes = FALSE)
++## cca
++mod <- cca(dune ~ Condition(Moisture) + Management + A1, dune.env)
++dat <- simulate(mod, indx = ind)
++all.equal(dat, target, check.attributes = FALSE)
++## capscale: Euclidean distances -- non-Euclidean distances have an
++## imaginary component and will not give back the data.
++d <- dist(dune)
++mod <- capscale(d ~ Condition(Moisture) + Management + A1, dune.env)
++dat <- simulate(mod, indx = ind)
++all.equal(dat, d, check.attributes = FALSE)
++## clean up
++rm(ind, target, mod, dat, d)
++### end simulate.*
++
++### test metaMDS works with long expression for comm
++### originally reported to GLS by Richard Telford
++data(varespec)
++set.seed(1)
++mod <- metaMDS(subset(varespec, select = colSums(varespec) > 0, subset = rowSums(varespec) > 0))
++mod
++rm(mod)
++### The above should run without error & last lines tests changes to the
++### printed output
++
++## dbrda tests
++
++## the following three should be all equal
++data(varespec, varechem)
++(mr <- rda(varespec ~ Al + P + Condition(pH), varechem))
++(md <- dbrda(varespec ~ Al + P + Condition(pH), varechem))
++(mc <- capscale(varespec ~ Al + P + Condition(pH), varechem))
++## the following two should be zero (within 1e-15)
++p <- shuffleSet(nrow(varespec), 999)
++range(permustats(anova(mr, permutations=p))$permutations -
++          permustats(anova(md, permutations=p))$permutations)
++range(permustats(anova(mr, permutations=p))$permutations -
++          permustats(anova(mc, permutations=p))$permutations)
++## the following two should be equal
++d <- vegdist(wisconsin(sqrt(varespec)))
++(md <- dbrda(d ~ Al + P + Condition(pH), varechem))
++(mc <- capscale(d ~ Al + P + Condition(pH), varechem))
++(amd <- anova(md, permutations = p))
++(amc <- anova(mc, permutations = p))
++## should be zero (within 1e-15)
++range(permustats(amd)$permutations - permustats(amc)$permutations)
++rm(mr, md, mc, d, amd, amc)
+diff --git a/tests/vegan-tests.Rout.save b/tests/vegan-tests.Rout.save
+new file mode 100644
+index 0000000..e5c5028
+--- /dev/null
++++ b/tests/vegan-tests.Rout.save
+@@ -0,0 +1,886 @@
++
++R Under development (unstable) (2016-06-08 r70729) -- "Unsuffered Consequences"
++Copyright (C) 2016 The R Foundation for Statistical Computing
++Platform: x86_64-pc-linux-gnu (64-bit)
++
++R is free software and comes with ABSOLUTELY NO WARRANTY.
++You are welcome to redistribute it under certain conditions.
++Type 'license()' or 'licence()' for distribution details.
++
++R is a collaborative project with many contributors.
++Type 'contributors()' for more information and
++'citation()' on how to cite R or R packages in publications.
++
++Type 'demo()' for some demos, 'help()' for on-line help, or
++'help.start()' for an HTML browser interface to help.
++Type 'q()' to quit R.
++
++> ### vegan-tests: unit tests for vegan functions
++> 
++> ### This file contains unit tests for vegan functions. This file is
++> ### run in R CMD check and its results are compared against previously
++> ### saved results in vegan-tests.Rout.save. If you change tests, you
++> ### must generate new vegan-tests.Rout.save in this directory.
++> 
++> ### The current plan is that tests/ are not included in the CRAN
++> ### release, but only in the development versin of vegan in R-Forge.
++> 
++> ### The tests here are not intended for human reading. The tests need
++> ### not be ecological or biologically meaningful, but they are only
++> ### intended for testing strange arguments, protect against
++> ### regressions and test correctness of results.
++> 
++> ### The tests are in a single file and you should clean work space
++> ### after the unit test. You should set random number seed (if needed)
++> ### for comparison against vegan-tests.Rout.save, and you should
++> ### remove the seed after the unit test. If possible, avoid very long
++> ### lasting tests.
++> 
++> ###<--- BEGIN TESTS --->
++> suppressPackageStartupMessages(require(vegan))
++> ###<--- BEGIN anova.cca test --->
++> ### anova.cca tests: should work with (1) subset, (2) missing values,
++> ### (3) with functions of variables poly(A1,2), (4) variables in data
++> ### frame attached or in data=, or (5) in working environment
++> set.seed(4711)
++> data(dune)
++> data(dune.env)
++> df <- dune.env
++> df$Management[c(1,5)] <- NA
++> ## formula
++> fla <- as.formula("dune ~ Management + poly(A1, 2) + spno")
++> ### variable in the .GlobalEnv
++> spno <- specnumber(dune)
++> ### data= argument
++> ## cca/rda
++> m <-  cca(fla, data=df,  na.action=na.exclude,  subset = Use != "Pasture" & spno > 7)
++> anova(m, permutations=99)
++Permutation test for cca under reduced model
++Permutation: free
++Number of permutations: 99
++
++Model: cca(formula = dune ~ Management + poly(A1, 2) + spno, data = df, na.action = na.exclude, subset = Use != "Pasture" & spno > 7)
++         Df ChiSquare      F Pr(>F)  
++Model     6   1.25838 1.3106   0.07 .
++Residual  5   0.80011                
++---
++Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
++> ## vegan 2.1-40 cannot handle missing data in next two
++> ##anova(m, by="term", permutations=99)
++> ##anova(m, by="margin", permutations=99)
++> anova(m, by="axis", permutations=99)
++Permutation test for cca under reduced model
++Marginal tests for axes
++Permutation: free
++Number of permutations: 99
++
++Model: cca(formula = dune ~ Management + poly(A1, 2) + spno, data = df, na.action = na.exclude, subset = object$subset)
++         Df ChiSquare      F Pr(>F)   
++CCA1      1   0.46993 2.9366   0.01 **
++CCA2      1   0.26217 1.6384   0.15   
++CCA3      1   0.19308 1.2066   0.29   
++CCA4      1   0.18345 1.1464   0.37   
++CCA5      1   0.08871 0.5544   0.77   
++CCA6      1   0.06104 0.3815   0.90   
++Residual  5   0.80011                 
++---
++Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
++> ## capscale
++> p <- capscale(fla, data=df, na.action=na.exclude, subset = Use != "Pasture" & spno > 7)
++> anova(p, permutations=99)
++Permutation test for capscale under reduced model
++Permutation: free
++Number of permutations: 99
++
++Model: capscale(formula = dune ~ Management + poly(A1, 2) + spno, data = df, na.action = na.exclude, subset = Use != "Pasture" & spno > 7)
++         Df Variance      F Pr(>F)  
++Model     6   59.582 1.6462   0.04 *
++Residual  5   30.160                
++---
++Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
++> ## vegan 2.1-40 cannot handle missing data in next two
++> ##anova(p, by="term", permutations=99)
++> ##anova(p, by="margin", permutations=99)
++> anova(p, by="axis", permutations=99)
++Permutation test for capscale under reduced model
++Marginal tests for axes
++Permutation: free
++Number of permutations: 99
++
++Model: capscale(formula = dune ~ Management + poly(A1, 2) + spno, data = df, na.action = na.exclude, subset = object$subset)
++         Df Variance      F Pr(>F)  
++CAP1      1  25.0252 4.1487   0.03 *
++CAP2      1  15.8759 2.6319   0.07 .
++CAP3      1   8.0942 1.3419   0.25  
++CAP4      1   5.0675 0.8401   0.64  
++CAP5      1   3.5671 0.5914   0.85  
++CAP6      1   1.9520 0.3236   0.96  
++Residual  5  30.1605                
++---
++Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
++> ## see that capscale can be updated and also works with 'dist' input
++> dis <- vegdist(dune)
++> p <- update(p, dis ~ .)
++> anova(p, permutations=99)
++Permutation test for capscale under reduced model
++Permutation: free
++Number of permutations: 99
++
++Model: capscale(formula = dis ~ Management + poly(A1, 2) + spno, data = df, na.action = na.exclude, subset = Use != "Pasture" & spno > 7)
++         Df SumOfSqs      F Pr(>F)
++Model     6  1.52798 1.6548   0.11
++Residual  5  0.76948              
++> ## vegan 2.1-40 cannot handle missing data in next two
++> ##anova(p, by="term", permutations=99)
++> ##anova(p, by="margin", permutations=99)
++> anova(p, by="axis", permutations=99)
++imaginary variation was discarded
++Permutation test for capscale under reduced model
++Marginal tests for axes
++Permutation: free
++Number of permutations: 99
++
++Model: capscale(formula = dis ~ Management + poly(A1, 2) + spno, data = df, na.action = na.exclude, subset = object$subset)
++         Df SumOfSqs      F Pr(>F)  
++CAP1      1  0.77834 4.9533   0.02 *
++CAP2      1  0.45691 2.9078   0.03 *
++CAP3      1  0.14701 0.9355   0.50  
++CAP4      1  0.11879 0.7560   0.65  
++CAP5      1  0.04213 0.2681   0.98  
++CAP6      1  0.00522 0.0332   1.00  
++Residual  5  0.76948                
++---
++Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
++> ### attach()ed data frame instead of data=
++> attach(df)
++> q <- cca(fla, na.action = na.omit, subset = Use != "Pasture" & spno > 7)
++> anova(q, permutations=99)
++Permutation test for cca under reduced model
++Permutation: free
++Number of permutations: 99
++
++Model: cca(formula = dune ~ Management + poly(A1, 2) + spno, na.action = na.omit, subset = Use != "Pasture" & spno > 7)
++         Df ChiSquare      F Pr(>F)
++Model     6   1.25838 1.3106   0.12
++Residual  5   0.80011              
++> ## commented tests below fail in vegan 2.1-40 because number of
++> ## observations changes
++> ##anova(q, by="term", permutations=99) 
++> ##anova(q, by="margin", permutations=99)
++> anova(q, by="axis", permutations=99)
++Permutation test for cca under reduced model
++Marginal tests for axes
++Permutation: free
++Number of permutations: 99
++
++Model: cca(formula = dune ~ Management + poly(A1, 2) + spno, na.action = na.omit, subset = object$subset)
++         Df ChiSquare      F Pr(>F)  
++CCA1      1   0.46993 2.9366   0.03 *
++CCA2      1   0.26217 1.6384   0.20  
++CCA3      1   0.19308 1.2066   0.34  
++CCA4      1   0.18345 1.1464   0.33  
++CCA5      1   0.08871 0.5544   0.69  
++CCA6      1   0.06104 0.3815   0.89  
++Residual  5   0.80011                
++---
++Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
++> ### Check that constrained ordination functions can be embedded.
++> ### The data.frame 'df' is still attach()ed.
++> foo <- function(bar, Y, X, ...)
+++ {
+++     bar <- match.fun(bar)
+++     bar(Y ~ X, ...)
+++ }
++> foo("cca", dune, Management, na.action = na.omit)
++Call: cca(formula = Y ~ X, na.action = ..1)
++
++              Inertia Proportion Rank
++Total          2.0949     1.0000     
++Constrained    0.6236     0.2977    3
++Unconstrained  1.4713     0.7023   14
++Inertia is mean squared contingency coefficient 
++2 observations deleted due to missingness 
++
++Eigenvalues for constrained axes:
++   CCA1    CCA2    CCA3 
++0.31573 0.20203 0.10584 
++
++Eigenvalues for unconstrained axes:
++   CA1    CA2    CA3    CA4    CA5    CA6    CA7    CA8    CA9   CA10   CA11 
++0.4478 0.1910 0.1788 0.1409 0.1202 0.0949 0.0732 0.0570 0.0531 0.0448 0.0312 
++  CA12   CA13   CA14 
++0.0181 0.0104 0.0098 
++
++> foo("rda", dune, Management, na.action = na.omit)
++Call: rda(formula = Y ~ X, na.action = ..1)
++
++              Inertia Proportion Rank
++Total         85.1176     1.0000     
++Constrained   32.7765     0.3851    3
++Unconstrained 52.3412     0.6149   14
++Inertia is variance 
++2 observations deleted due to missingness 
++
++Eigenvalues for constrained axes:
++  RDA1   RDA2   RDA3 
++15.956 13.621  3.199 
++
++Eigenvalues for unconstrained axes:
++   PC1    PC2    PC3    PC4    PC5    PC6    PC7    PC8    PC9   PC10   PC11 
++14.893  9.136  6.042  5.674  3.638  2.865  2.504  1.968  1.888  1.239  0.959 
++  PC12   PC13   PC14 
++ 0.779  0.501  0.255 
++
++> foo("capscale", dune, Management, dist="jaccard", na.action = na.omit)
++Call: bar(formula = Y ~ X, distance = "jaccard", na.action = ..2)
++
++              Inertia Proportion Rank
++Total          5.1432     1.0000     
++Constrained    1.6453     0.3199    3
++Unconstrained  3.4979     0.6801   14
++Inertia is squared Jaccard distance 
++2 observations deleted due to missingness 
++
++Eigenvalues for constrained axes:
++  CAP1   CAP2   CAP3 
++0.8504 0.6047 0.1902 
++
++Eigenvalues for unconstrained axes:
++  MDS1   MDS2   MDS3   MDS4   MDS5   MDS6   MDS7   MDS8   MDS9  MDS10  MDS11 
++1.0474 0.4406 0.4386 0.4054 0.2847 0.1947 0.1546 0.1506 0.0957 0.0935 0.0761 
++ MDS12  MDS13  MDS14 
++0.0603 0.0436 0.0120 
++
++> foo("capscale", vegdist(dune), Management, na.action = na.omit)
++Call: bar(formula = Y ~ X, na.action = ..1)
++
++              Inertia Proportion Eigenvals Rank
++Total          3.7652     1.0000    3.9493     
++Constrained    1.4179     0.3766    1.4456    3
++Unconstrained  2.3473     0.6234    2.5037   13
++Imaginary                          -0.1841    4
++Inertia is squared Bray distance 
++2 observations deleted due to missingness 
++
++Eigenvalues for constrained axes:
++  CAP1   CAP2   CAP3 
++0.7910 0.5497 0.1050 
++
++Eigenvalues for unconstrained axes:
++  MDS1   MDS2   MDS3   MDS4   MDS5   MDS6   MDS7   MDS8   MDS9  MDS10  MDS11 
++1.0756 0.3691 0.3349 0.2695 0.1651 0.0931 0.0726 0.0673 0.0286 0.0174 0.0093 
++ MDS12  MDS13 
++0.0011 0.0001 
++
++> foo("capscale", dune, Management, na.action = na.omit) ## fails in 2.2-1
++Call: bar(formula = Y ~ X, na.action = ..1)
++
++              Inertia Proportion Rank
++Total         85.1176     1.0000     
++Constrained   32.7765     0.3851    3
++Unconstrained 52.3412     0.6149   14
++Inertia is mean squared Euclidean distance 
++2 observations deleted due to missingness 
++
++Eigenvalues for constrained axes:
++  CAP1   CAP2   CAP3 
++15.956 13.621  3.199 
++
++Eigenvalues for unconstrained axes:
++  MDS1   MDS2   MDS3   MDS4   MDS5   MDS6   MDS7   MDS8   MDS9  MDS10  MDS11 
++14.893  9.136  6.042  5.674  3.638  2.865  2.504  1.968  1.888  1.239  0.959 
++ MDS12  MDS13  MDS14 
++ 0.779  0.501  0.255 
++
++> ###
++> detach(df)
++> ### Check that statistics match in partial constrained ordination
++> m <- cca(dune ~ A1 + Moisture + Condition(Management), dune.env, subset = A1 > 3)
++> tab <- anova(m, by = "axis", permutations = 99)
++> m
++Call: cca(formula = dune ~ A1 + Moisture + Condition(Management), data
++= dune.env, subset = A1 > 3)
++
++              Inertia Proportion Rank
++Total          2.0976     1.0000     
++Conditional    0.6251     0.2980    3
++Constrained    0.5555     0.2648    4
++Unconstrained  0.9170     0.4372   10
++Inertia is mean squared contingency coefficient 
++
++Eigenvalues for constrained axes:
++   CCA1    CCA2    CCA3    CCA4 
++0.27109 0.14057 0.08761 0.05624 
++
++Eigenvalues for unconstrained axes:
++    CA1     CA2     CA3     CA4     CA5     CA6     CA7     CA8     CA9    CA10 
++0.31042 0.13634 0.11974 0.09408 0.07763 0.06425 0.04449 0.02925 0.02785 0.01299 
++
++> tab
++Permutation test for cca under reduced model
++Marginal tests for axes
++Permutation: free
++Number of permutations: 99
++
++Model: cca(formula = dune ~ A1 + Moisture + Condition(Management), data = dune.env, subset = object$subset)
++         Df ChiSquare      F Pr(>F)  
++CCA1      1   0.27109 2.9561   0.04 *
++CCA2      1   0.14057 1.5329   0.21  
++CCA3      1   0.08761 0.9553   0.72  
++CCA4      1   0.05624 0.6132   0.97  
++Residual 10   0.91705                
++---
++Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
++> all.equal(tab[,2], c(m$CCA$eig, m$CA$tot.chi), check.attributes=FALSE)
++[1] TRUE
++> tab[nrow(tab),1] == m$CA$rank
++[1] TRUE
++> ## clean-up
++> rm(df, spno, fla, m, p, q, tab, dis, foo, .Random.seed)
++> ### <--- END anova.cca test --->
++> 
++> ### Sven Neulinger <sneulinger@ifam.uni-kiel.de> reported failures in
++> ### partial analysis which (mostly) were fixed in r2087. Below his test.
++> 
++> set.seed(4711)
++> X <- matrix(rnorm(30*6), 30, 6)
++> 
++> A <- factor(rep(rep(c("a","b"), each=3),5))
++> B <- factor(rep(c("a","b","c"), 10))
++> ## Sven Neulinger's tests failed still in 2.2-1, now due to look-up
++> ## order: function stats::C was found before matrix 'C'. The test was
++> ## OK when non-function name was used ('CC').
++> C <- factor(rep(c(1:5), each=6))
++> 
++> ## partial db-RDA
++> cap.model.cond <- capscale(X ~ A + B + Condition(C))
++> anova(cap.model.cond, by="axis", strata=C)  # -> error pre r2287
++Permutation test for capscale under reduced model
++Marginal tests for axes
++Blocks:  strata 
++Permutation: free
++Number of permutations: 999
++
++Model: capscale(formula = X ~ A + B + Condition(C))
++         Df Variance      F Pr(>F)
++CAP1      1   0.2682 1.3075  0.242
++CAP2      1   0.0685 0.3339  0.921
++CAP3      1   0.0455 0.2217  0.966
++Residual 22   4.5130              
++> anova(cap.model.cond, by="terms", strata=C)  # -> error pre r2287
++Permutation test for capscale under reduced model
++Terms added sequentially (first to last)
++Blocks:  strata 
++Permutation: free
++Number of permutations: 999
++
++Model: capscale(formula = X ~ A + B + Condition(C))
++         Df Variance      F Pr(>F)
++A         1   0.1316 0.6415  0.680
++B         2   0.2506 0.6108  0.824
++Residual 22   4.5130              
++> 
++> ## db-RDA without conditional factor
++> cap.model <- capscale(X ~ A + B)
++> anova(cap.model, by="axis", strata=C)  # -> no error
++Permutation test for capscale under reduced model
++Marginal tests for axes
++Blocks:  strata 
++Permutation: free
++Number of permutations: 999
++
++Model: capscale(formula = X ~ A + B)
++         Df Variance      F Pr(>F)
++CAP1      1   0.2682 1.3267  0.240
++CAP2      1   0.0685 0.3388  0.913
++CAP3      1   0.0455 0.2249  0.964
++Residual 26   5.2565              
++> anova(cap.model, by="terms", strata=C)  # -> no error
++Permutation test for capscale under reduced model
++Terms added sequentially (first to last)
++Blocks:  strata 
++Permutation: free
++Number of permutations: 999
++
++Model: capscale(formula = X ~ A + B)
++         Df Variance      F Pr(>F)
++A         1   0.1316 0.6509  0.693
++B         2   0.2506 0.6198  0.829
++Residual 26   5.2565              
++> 
++> # partial RDA
++> rda.model.cond <- rda(X ~ A + B + Condition(C))
++> anova(rda.model.cond, by="axis", strata=C)  # -> no error
++Permutation test for rda under reduced model
++Marginal tests for axes
++Blocks:  strata 
++Permutation: free
++Number of permutations: 999
++
++Model: rda(formula = X ~ A + B + Condition(C))
++         Df Variance      F Pr(>F)
++RDA1      1   0.2682 1.3075  0.286
++RDA2      1   0.0685 0.3339  0.921
++RDA3      1   0.0455 0.2217  0.963
++Residual 22   4.5130              
++> anova(rda.model.cond, by="terms", strata=C)  # -> error pre r2287
++Permutation test for rda under reduced model
++Terms added sequentially (first to last)
++Blocks:  strata 
++Permutation: free
++Number of permutations: 999
++
++Model: rda(formula = X ~ A + B + Condition(C))
++         Df Variance      F Pr(>F)
++A         1   0.1316 0.6415  0.669
++B         2   0.2506 0.6108  0.827
++Residual 22   4.5130              
++> 
++> # RDA without conditional factor
++> rda.model <- rda(X ~ A + B)
++> anova(rda.model, by="axis", strata=C)  # -> no error
++Permutation test for rda under reduced model
++Marginal tests for axes
++Blocks:  strata 
++Permutation: free
++Number of permutations: 999
++
++Model: rda(formula = X ~ A + B)
++         Df Variance      F Pr(>F)
++RDA1      1   0.2682 1.3267  0.258
++RDA2      1   0.0685 0.3388  0.898
++RDA3      1   0.0455 0.2249  0.971
++Residual 26   5.2565              
++> anova(rda.model, by="terms", strata=C)  # -> no error
++Permutation test for rda under reduced model
++Terms added sequentially (first to last)
++Blocks:  strata 
++Permutation: free
++Number of permutations: 999
++
++Model: rda(formula = X ~ A + B)
++         Df Variance      F Pr(>F)
++A         1   0.1316 0.6509  0.695
++B         2   0.2506 0.6198  0.820
++Residual 26   5.2565              
++> ## clean.up
++> rm(X, A, B, C, cap.model.cond, cap.model, rda.model.cond, rda.model)
++> ### end Sven Neulinger's tests
++> 
++> ### Benedicte Bachelot informed us that several anova.cca* functions
++> ### failed if community data name was the same as a function name: the
++> ### function name was found first, and used instead ofa data. This
++> ### seems to be related to the same problem that Sven Neulinger
++> ### communicated, and his examples still faile if Condition or strata
++> ### are function names. However, the following examples that failed
++> ### should work now:
++> 
++> set.seed(4711)
++> cca <- dune
++> m <- cca(cca ~ ., dune.env)
++> anova(m, by="term")
++Permutation test for cca under reduced model
++Terms added sequentially (first to last)
++Permutation: free
++Number of permutations: 999
++
++Model: cca(formula = cca ~ A1 + Moisture + Management + Use + Manure, data = dune.env)
++           Df ChiSquare      F Pr(>F)   
++A1          1   0.22476 2.5704  0.010 **
++Moisture    3   0.51898 1.9783  0.008 **
++Management  3   0.39543 1.5074  0.064 . 
++Use         2   0.10910 0.6238  0.905   
++Manure      3   0.25490 0.9717  0.493   
++Residual    7   0.61210                 
++---
++Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
++> m <- capscale(cca ~ ., dune.env)
++> anova(m, by="term")
++Permutation test for capscale under reduced model
++Terms added sequentially (first to last)
++Permutation: free
++Number of permutations: 999
++
++Model: capscale(formula = cca ~ A1 + Moisture + Management + Use + Manure, data = dune.env)
++           Df Variance      F Pr(>F)   
++A1          1   8.1148 2.7156  0.008 **
++Moisture    3  21.6497 2.4150  0.008 **
++Management  3  19.1153 2.1323  0.009 **
++Use         2   4.7007 0.7865  0.730   
++Manure      3   9.6257 1.0737  0.377   
++Residual    7  20.9175                 
++---
++Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
++> rm(m, cca)
++> 
++> ### end Benedicte Bachelot tests
++> 
++> ### Richard Telford tweeted this example on 23/2/2015. Fails in 2.2-1,
++> ### but should work now. Also issue #100 in github.com/vegandevs/vegan.
++> set.seed(4711)
++> data(dune, dune.env)
++> foo <- function(x, env) {
+++     m <- rda(x ~ Manure + A1, data = env)
+++     anova(m, by = "margin")
+++ }
++> out <- lapply(dune, foo, env = dune.env)
++> out$Poatriv
++Permutation test for rda under reduced model
++Marginal effects of terms
++Permutation: free
++Number of permutations: 999
++
++Model: rda(formula = x ~ Manure + A1, data = env)
++         Df Variance      F Pr(>F)   
++Manure    4   4.7257 5.7006  0.009 **
++A1        1   0.0153 0.0736  0.783   
++Residual 14   2.9014                 
++---
++Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
++> rm(foo, out)
++> ### end Richard Telford test
++> 
++> 
++> ### nestednodf: test case by Daniel Spitale in a comment to News on
++> ### the release of vegan 1.17-6 in vegan.r-forge.r-project.org.
++> x <- c(1,0,1,1,1,1,1,1,0,0,0,1,1,1,0,1,1,0,0,0,1,1,0,0,0)
++> m1 <- matrix(x, nrow=5, ncol=5, byrow=FALSE)# as in Fig 2 Almeida-Neto et al 2008.
++> (nodf1 <- nestednodf(m1, order = FALSE, weighted = FALSE))
++N columns  : 53.33333 
++N rows     : 63.33333 
++NODF       : 58.33333 
++Matrix fill: 0.56 
++> ## Now the same matrix but with abundance data
++> x <- c(5,0,2,1,1,4,1,1,0,0,0,7,1,1,0,3,1,0,0,0,9,1,0,0,0)
++> m <- matrix(x, nrow=5, ncol=5, byrow=FALSE)
++> (nodfq <- nestednodf(m, order = FALSE, weighted = FALSE))
++N columns  : 53.33333 
++N rows     : 63.33333 
++NODF       : 58.33333 
++Matrix fill: 0.56 
++> identical(nodf1, nodfq)
++[1] TRUE
++> rm(x, m, m1, nodfq, nodf1)
++> ### end nestednodf
++> 
++> ### envfit & plot.envfit: latter failed if na.action resulted in only
++> ### observation with a given factor level was removed. plot.envfit would
++> ### fail with error about too long subscript
++> ### fixed case where data presented to envfit also has extraneous levels
++> data(dune)
++> data(dune.env)
++> ## add a new level to one of the factors
++> levels(dune.env$Management) <- c(levels(dune.env$Management), "foo")
++> ## fit nMDS and envfit
++> set.seed(1)
++> mod <- metaMDS(dune)
++Run 0 stress 0.1192678 
++Run 1 stress 0.1886532 
++Run 2 stress 0.1192678 
++... New best solution
++... Procrustes: rmse 4.497004e-05  max resid 0.0001297349 
++... Similar to previous best
++Run 3 stress 0.1192678 
++... New best solution
++... Procrustes: rmse 1.801542e-05  max resid 5.078152e-05 
++... Similar to previous best
++Run 4 stress 0.1183186 
++... New best solution
++... Procrustes: rmse 0.02025988  max resid 0.06488321 
++Run 5 stress 0.1192685 
++Run 6 stress 0.1939202 
++Run 7 stress 0.1808919 
++Run 8 stress 0.1183186 
++... Procrustes: rmse 1.538285e-05  max resid 4.789705e-05 
++... Similar to previous best
++Run 9 stress 0.1192679 
++Run 10 stress 0.1183186 
++... New best solution
++... Procrustes: rmse 1.244871e-05  max resid 3.745684e-05 
++... Similar to previous best
++Run 11 stress 0.1192686 
++Run 12 stress 0.1192683 
++Run 13 stress 0.1886532 
++Run 14 stress 0.1183186 
++... Procrustes: rmse 2.260742e-06  max resid 5.293932e-06 
++... Similar to previous best
++Run 15 stress 0.1192678 
++Run 16 stress 0.1183186 
++... Procrustes: rmse 3.225938e-06  max resid 7.314283e-06 
++... Similar to previous best
++Run 17 stress 0.2075713 
++Run 18 stress 0.1192678 
++Run 19 stress 0.1192685 
++Run 20 stress 0.1183186 
++... Procrustes: rmse 2.295609e-05  max resid 6.384852e-05 
++... Similar to previous best
++*** Solution reached
++> ef <- envfit(mod, dune.env, permutations = 99)
++> plot(mod)
++> plot(ef, p.max = 0.1)
++> rm(mod, ef)
++> ### end envfit & plot.envfit
++> 
++> ### protest (& Procrustes analysis): Stability of the permutations and
++> ### other results.
++> data(mite)
++> mod <- rda(mite)
++> x <- scores(mod, display = "si", choices=1:6)
++> set.seed(4711)
++> xp <- x[sample(nrow(x)),]
++> pro <- protest(x, xp, permutations = how(nperm = 99))
++> pro
++
++Call:
++protest(X = x, Y = xp, permutations = how(nperm = 99)) 
++
++Procrustes Sum of Squares (m12 squared):        0.9147 
++Correlation in a symmetric Procrustes rotation: 0.292 
++Significance:  0.08 
++
++Permutation: free
++Number of permutations: 99
++
++> pro$t
++ [1] 0.2056649 0.2008622 0.2062525 0.2656158 0.2739148 0.1990895 0.3124461
++ [8] 0.2287779 0.2033140 0.2396172 0.1868019 0.2736072 0.1830199 0.2026019
++[15] 0.2402570 0.2286169 0.2791609 0.2214468 0.2356083 0.2188325 0.2097262
++[22] 0.2596154 0.2560289 0.2190367 0.2174689 0.2438396 0.1991101 0.2374612
++[29] 0.2030745 0.2205115 0.2566758 0.1448623 0.2354268 0.2419134 0.3144177
++[36] 0.2368505 0.2442661 0.2272011 0.3184241 0.2200089 0.2598430 0.2301587
++[43] 0.2763337 0.2332606 0.1935269 0.2315727 0.2573623 0.2021127 0.2387335
++[50] 0.2419087 0.2213094 0.2231619 0.2577845 0.2828219 0.2554605 0.2830915
++[57] 0.2342396 0.2137396 0.2151201 0.2432896 0.1956238 0.2055716 0.2329736
++[64] 0.2086125 0.2039124 0.1955711 0.2038045 0.2358886 0.2579199 0.1808128
++[71] 0.2155189 0.2967100 0.2480105 0.2010537 0.2718478 0.2182713 0.2471893
++[78] 0.2310223 0.2007771 0.2902640 0.2392380 0.2551756 0.3476679 0.2632614
++[85] 0.2289929 0.2222382 0.2503562 0.1983700 0.2084773 0.2406556 0.2478302
++[92] 0.2136439 0.3251671 0.2048928 0.3098776 0.2501555 0.2677039 0.2427125
++[99] 0.2693285
++> rm(x, xp, pro)
++> ### end protest
++> 
++> ### Check that functions related to predict.rda work correctly for all
++> ### constrained ordination methods.
++> 
++> ### simulate.rda/cca/capscale: based on predict.* and the following
++> ### should get back the data
++> data(dune, dune.env)
++> ind <- seq_len(nrow(dune))
++> target <- as.matrix(dune)
++> ## rda
++> mod <- rda(dune ~ Condition(Moisture) + Management + A1, dune.env)
++> dat <- simulate(mod, indx = ind)
++> all.equal(dat, target, check.attributes = FALSE)
++[1] TRUE
++> ## cca
++> mod <- cca(dune ~ Condition(Moisture) + Management + A1, dune.env)
++> dat <- simulate(mod, indx = ind)
++> all.equal(dat, target, check.attributes = FALSE)
++[1] TRUE
++> ## capscale: Euclidean distances -- non-Euclidean distances have an
++> ## imaginary component and will not give back the data.
++> d <- dist(dune)
++> mod <- capscale(d ~ Condition(Moisture) + Management + A1, dune.env)
++> dat <- simulate(mod, indx = ind)
++> all.equal(dat, d, check.attributes = FALSE)
++[1] TRUE
++> ## clean up
++> rm(ind, target, mod, dat, d)
++> ### end simulate.*
++> 
++> ### test metaMDS works with long expression for comm
++> ### originally reported to GLS by Richard Telford
++> data(varespec)
++> set.seed(1)
++> mod <- metaMDS(subset(varespec, select = colSums(varespec) > 0, subset = rowSums(varespec) > 0))
++Square root transformation
++Wisconsin double standardization
++Run 0 stress 0.1843196 
++Run 1 stress 0.2455912 
++Run 2 stress 0.2169407 
++Run 3 stress 0.2313231 
++Run 4 stress 0.1974406 
++Run 5 stress 0.1858402 
++Run 6 stress 0.1948414 
++Run 7 stress 0.2265717 
++Run 8 stress 0.222507 
++Run 9 stress 0.2023215 
++Run 10 stress 0.2673177 
++Run 11 stress 0.1976151 
++Run 12 stress 0.1852397 
++Run 13 stress 0.2341085 
++Run 14 stress 0.1955867 
++Run 15 stress 0.2137409 
++Run 16 stress 0.2109638 
++Run 17 stress 0.1825658 
++... New best solution
++... Procrustes: rmse 0.04169825  max resid 0.1521436 
++Run 18 stress 0.1843197 
++Run 19 stress 0.2570119 
++Run 20 stress 0.3760596 
++*** No convergence -- monoMDS stopping criteria:
++    20: stress ratio > sratmax
++> mod
++
++Call:
++metaMDS(comm = subset(varespec, select = colSums(varespec) >      0, subset = rowSums(varespec) > 0)) 
++
++global Multidimensional Scaling using monoMDS
++
++Data:     wisconsin(sqrt(subset(varespec, select = colSums(varespec) > 0, subset = rowSums(varespec) > 0))) 
++Distance: bray 
++
++Dimensions: 2 
++Stress:     0.1825658 
++Stress type 1, weak ties
++No convergent solutions - best solution after 20 tries
++Scaling: centring, PC rotation, halfchange scaling 
++Species: expanded scores based on 'wisconsin(sqrt(subset(varespec, select = colSums(varespec) > 0, subset = rowSums(varespec) > 0)))' 
++
++> rm(mod)
++> ### The above should run without error & last lines tests changes to the
++> ### printed output
++> 
++> ## dbrda tests
++> 
++> ## the following three should be all equal
++> data(varespec, varechem)
++> (mr <- rda(varespec ~ Al + P + Condition(pH), varechem))
++Call: rda(formula = varespec ~ Al + P + Condition(pH), data = varechem)
++
++                Inertia Proportion Rank
++Total         1825.6594     1.0000     
++Conditional    234.0961     0.1282    1
++Constrained    424.4375     0.2325    2
++Unconstrained 1167.1258     0.6393   20
++Inertia is variance 
++
++Eigenvalues for constrained axes:
++  RDA1   RDA2 
++314.60 109.84 
++
++Eigenvalues for unconstrained axes:
++  PC1   PC2   PC3   PC4   PC5   PC6   PC7   PC8 
++692.3 171.3 106.1  59.9  35.1  30.1  22.4  16.8 
++(Showed only 8 of all 20 unconstrained eigenvalues)
++
++> (md <- dbrda(varespec ~ Al + P + Condition(pH), varechem))
++Call: dbrda(formula = varespec ~ Al + P + Condition(pH), data =
++varechem)
++
++                Inertia Proportion Rank
++Total         1825.6594     1.0000     
++Conditional    234.0961     0.1282    1
++Constrained    424.4375     0.2325    2
++Unconstrained 1167.1258     0.6393   20
++Inertia is mean squared Euclidean distance 
++
++Eigenvalues for constrained axes:
++dbRDA1 dbRDA2 
++314.60 109.84 
++
++Eigenvalues for unconstrained axes:
++ MDS1  MDS2  MDS3  MDS4  MDS5  MDS6  MDS7  MDS8 
++692.3 171.3 106.1  59.9  35.1  30.1  22.4  16.8 
++(Showed only 8 of all 20 unconstrained eigenvalues)
++
++> (mc <- capscale(varespec ~ Al + P + Condition(pH), varechem))
++Call: capscale(formula = varespec ~ Al + P + Condition(pH), data =
++varechem)
++
++                Inertia Proportion Rank
++Total         1825.6594     1.0000     
++Conditional    234.0961     0.1282    1
++Constrained    424.4375     0.2325    2
++Unconstrained 1167.1258     0.6393   20
++Inertia is mean squared Euclidean distance 
++
++Eigenvalues for constrained axes:
++  CAP1   CAP2 
++314.60 109.84 
++
++Eigenvalues for unconstrained axes:
++ MDS1  MDS2  MDS3  MDS4  MDS5  MDS6  MDS7  MDS8 
++692.3 171.3 106.1  59.9  35.1  30.1  22.4  16.8 
++(Showed only 8 of all 20 unconstrained eigenvalues)
++
++> ## the following two should be zero (within 1e-15)
++> p <- shuffleSet(nrow(varespec), 999)
++> range(permustats(anova(mr, permutations=p))$permutations -
+++           permustats(anova(md, permutations=p))$permutations)
++[1] -1.776357e-15  3.996803e-15
++> range(permustats(anova(mr, permutations=p))$permutations -
+++           permustats(anova(mc, permutations=p))$permutations)
++[1] -1.776357e-15  4.884981e-15
++> ## the following two should be equal
++> d <- vegdist(wisconsin(sqrt(varespec)))
++> (md <- dbrda(d ~ Al + P + Condition(pH), varechem))
++Call: dbrda(formula = d ~ Al + P + Condition(pH), data = varechem)
++
++              Inertia Proportion Rank RealDims
++Total         2.54753    1.00000              
++Conditional   0.18911    0.07423    1         
++Constrained   0.39839    0.15638    2        2
++Unconstrained 1.96003    0.76939   20       17
++Inertia is squared Bray distance 
++
++Eigenvalues for constrained axes:
++ dbRDA1  dbRDA2 
++0.29646 0.10193 
++
++Eigenvalues for unconstrained axes:
++  MDS1   MDS2   MDS3   MDS4   MDS5   MDS6   MDS7   MDS8 
++0.4503 0.3031 0.2389 0.1677 0.1495 0.1444 0.1339 0.1112 
++(Showed only 8 of all 20 unconstrained eigenvalues)
++
++> (mc <- capscale(d ~ Al + P + Condition(pH), varechem))
++Call: capscale(formula = d ~ Al + P + Condition(pH), data = varechem)
++
++               Inertia Proportion Eigenvals Rank
++Total          2.54753    1.00000   2.59500     
++Conditional    0.18911    0.07423   0.19141    1
++Constrained    0.39839    0.15638   0.39920    2
++Unconstrained  1.96003    0.76939   2.00439   19
++Imaginary                          -0.04747    4
++Inertia is squared Bray distance 
++
++Eigenvalues for constrained axes:
++   CAP1    CAP2 
++0.29718 0.10201 
++
++Eigenvalues for unconstrained axes:
++  MDS1   MDS2   MDS3   MDS4   MDS5   MDS6   MDS7   MDS8 
++0.4505 0.3032 0.2394 0.1677 0.1504 0.1450 0.1341 0.1113 
++(Showed only 8 of all 19 unconstrained eigenvalues)
++
++> (amd <- anova(md, permutations = p))
++Permutation test for dbrda under reduced model
++Permutation: free
++Number of permutations: 999
++
++Model: dbrda(formula = d ~ Al + P + Condition(pH), data = varechem)
++         Df SumOfSqs      F Pr(>F)   
++Model     2  0.39839 2.0325  0.002 **
++Residual 20  1.96003                 
++---
++Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
++> (amc <- anova(mc, permutations = p))
++Permutation test for capscale under reduced model
++Permutation: free
++Number of permutations: 999
++
++Model: capscale(formula = d ~ Al + P + Condition(pH), data = varechem)
++         Df SumOfSqs      F Pr(>F)   
++Model     2  0.39839 2.0325  0.002 **
++Residual 20  1.96003                 
++---
++Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
++> ## should be zero (within 1e-15)
++> range(permustats(amd)$permutations - permustats(amc)$permutations)
++[1] -8.881784e-16  6.661338e-16
++> rm(mr, md, mc, d, amd, amc)
++> 
++> proc.time()
++   user  system elapsed 
++  9.516   0.056   9.566