[med-svn] [r-cran-vegan] 01/05: Imported Upstream version 2.3-1

Andreas Tille tille at debian.org
Tue Nov 10 20:21:03 UTC 2015


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository r-cran-vegan.

commit 8fe98ea3a64106e1570d1b1b9214c6c000146b23
Author: Andreas Tille <tille at debian.org>
Date:   Tue Nov 10 21:08:56 2015 +0100

    Imported Upstream version 2.3-1
---
 DESCRIPTION                     |  10 +--
 MD5                             | 135 ++++++++++++++++++++--------------------
 NAMESPACE                       |   4 +-
 R/adonis.R                      |   6 +-
 R/alias.cca.R                   |   4 +-
 R/anosim.R                      |   3 +-
 R/anova.cca.R                   |  16 +++--
 R/anova.ccabyterm.R             |  70 ++++++++++++++-------
 R/anova.ccalist.R               |  30 +++++----
 R/anova.ccanull.R               |  21 ++++---
 R/biplot.rda.R                  |   7 ++-
 R/centroids.cca.R               |   2 +-
 R/factorfit.R                   |   3 +-
 R/mantel.R                      |   3 +-
 R/mantel.partial.R              |   3 +-
 R/metaMDS.R                     |  21 ++++---
 R/metaMDSdist.R                 |   1 +
 R/monoMDS.R                     |   2 +-
 R/mrpp.R                        |   3 +-
 R/mso.R                         |   4 +-
 R/oecosimu.R                    |  11 +++-
 R/ordiR2step.R                  |   5 ++
 R/ordiareatest.R                |   3 +-
 R/permustats.R                  |  37 +++++++----
 R/permutest.betadisper.R        |  10 +--
 R/permutest.cca.R               |   4 --
 R/plot.cca.R                    |  10 +--
 R/plot.prc.R                    |   9 +--
 R/points.cca.R                  |   9 +--
 R/predict.cca.R                 |  11 ++--
 R/predict.rda.R                 |  11 ++--
 R/print.cca.R                   |   2 +-
 R/print.permutest.cca.R         |   3 +-
 R/protest.R                     |   3 +-
 R/rarecurve.R                   |  10 +++
 R/scalingUtils.R                |  27 ++++++++
 R/scores.cca.R                  |  22 ++++---
 R/scores.rda.R                  |   6 +-
 R/simper.R                      |   3 +-
 R/summary.cca.R                 |  14 +++--
 R/summary.prc.R                 |   7 +--
 R/text.cca.R                    |   9 +--
 R/tolerance.cca.R               |   9 ++-
 R/vectorfit.R                   |   3 +-
 data/BCI.env.rda                | Bin 0 -> 337 bytes
 inst/NEWS.Rd                    |  79 +++++++++++++++++++++++
 inst/doc/FAQ-vegan.pdf          | Bin 148353 -> 148353 bytes
 inst/doc/NEWS.html              |  92 +++++++++++++++++++++++++++
 inst/doc/decision-vegan.pdf     | Bin 342516 -> 342248 bytes
 inst/doc/diversity-vegan.pdf    | Bin 365737 -> 365321 bytes
 inst/doc/intro-vegan.pdf        | Bin 235169 -> 234771 bytes
 man/BCI.Rd                      |  42 +++++++++----
 man/adipart.Rd                  |   6 +-
 man/anova.cca.Rd                |   5 +-
 man/biplot.rda.Rd               |  22 +++++--
 man/cca.Rd                      |   4 +-
 man/diversity.Rd                | 107 +++++--------------------------
 man/monoMDS.Rd                  |   2 +-
 man/permustats.Rd               |  12 ++--
 man/plot.cca.Rd                 |  75 ++++++++++++++--------
 man/prc.Rd                      |  23 +++++--
 man/predict.cca.Rd              |  16 +++--
 man/{diversity.Rd => rarefy.Rd} |  95 ++++------------------------
 man/specaccum.Rd                |  77 +++++++++++------------
 man/tolerance.Rd                |   8 ++-
 vignettes/FAQ-vegan.pdf         | Bin 148353 -> 148353 bytes
 vignettes/NEWS.html             |  92 +++++++++++++++++++++++++++
 vignettes/decision-vegan.tex    |  20 +++---
 vignettes/diversity-vegan.tex   |  80 ++++++++++++------------
 vignettes/intro-vegan.tex       |  50 +++++++--------
 70 files changed, 915 insertions(+), 578 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 1500a1c..f598246 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,12 +1,12 @@
 Package: vegan
 Title: Community Ecology Package
-Version: 2.3-0
-Date: 2015-05-21
+Version: 2.3-1
+Date: 2015-09-24
 Author: Jari Oksanen, F. Guillaume Blanchet, Roeland Kindt, Pierre Legendre, 
    Peter R. Minchin, R. B. O'Hara, Gavin L. Simpson, Peter Solymos, 
    M. Henry H. Stevens, Helene Wagner  
 Maintainer: Jari Oksanen <jari.oksanen at oulu.fi>
-Depends: permute (>= 0.7-8), lattice, R (>= 2.15.0)
+Depends: permute (>= 0.8-0), lattice, R (>= 2.15.0)
 Suggests: parallel, tcltk
 Imports: MASS, cluster, mgcv
 Description: Ordination methods, diversity analysis and other
@@ -15,6 +15,6 @@ License: GPL-2
 BugReports: https://github.com/vegandevs/vegan/issues
 URL: http://cran.r-project.org, https://github.com/vegandevs/vegan
 NeedsCompilation: yes
-Packaged: 2015-05-26 13:00:30 UTC; jarioksa
+Packaged: 2015-09-24 08:02:30 UTC; jarioksa
 Repository: CRAN
-Date/Publication: 2015-05-26 15:48:55
+Date/Publication: 2015-09-25 16:36:22
diff --git a/MD5 b/MD5
index 1b8c1cc..ee62634 100644
--- a/MD5
+++ b/MD5
@@ -1,5 +1,5 @@
-a736a57bc5431a4a5aa60a003b2d494d *DESCRIPTION
-031d8a7624ea3ab751b40d2f64235025 *NAMESPACE
+892d33e3f1891ca722425eb3285de1b8 *DESCRIPTION
+74e30d6065203c6637702eb35845f898 *NAMESPACE
 4b8531b446af54510e5fb31f841aed2f *R/AIC.radfit.R
 e9814d051bdf49db5606399ac3a4704e *R/CCorA.R
 6d37bd49a8a0048cbb7ff8f49487ba63 *R/MDSrotate.R
@@ -15,14 +15,14 @@ d80688d78aba3cd9367ffaaaec6ec252 *R/TukeyHSD.betadisper.R
 3fea698281bc0b4c3a5ad26f4d44d0e2 *R/adipart.R
 385380b5137c957be9f03e464100faa4 *R/adipart.default.R
 05387ee9e552fcec123b4b922e837eaa *R/adipart.formula.R
-1699e302c91aec89bb8d439f34eb52c0 *R/adonis.R
-fa709efe7fb59234727895d3bbb77419 *R/alias.cca.R
-25b2fc4e8494024d7163b0de60ace240 *R/anosim.R
+39e31afea454392fd69d2dbcc2f4e4ef *R/adonis.R
+7331b1428563ed9add00b088b50617fd *R/alias.cca.R
+0252a177ecb7705c3ce3e4157d3fa930 *R/anosim.R
 a4f23289c4a5eab2a3587292b306d497 *R/anova.betadisper.R
-68e6eb427d128f411b19e19bb15f4c6c *R/anova.cca.R
-9ea258cc0b669ee9a3b997541b802ee1 *R/anova.ccabyterm.R
-109e34d3c1a5cde84a6b427f91d0d649 *R/anova.ccalist.R
-97cbe54d0f4f7adee7a20b6c982d1ecf *R/anova.ccanull.R
+8f7a12b9419460caab8c963484d48a9d *R/anova.cca.R
+e5ca7c161ec8be59955e3c761828417c *R/anova.ccabyterm.R
+14ae37479048f37047826b0b60f973a7 *R/anova.ccalist.R
+41393fc55cc5e6a0ec3f12e18e086fd2 *R/anova.ccanull.R
 7fab08bcc596df60a22c4b04c8507121 *R/anova.prc.R
 6fb2bf929aed44ef41bfd4dfc6e010cc *R/as.fisher.R
 66c29064fff4854203ab2cd50e661558 *R/as.hclust.spantree.R
@@ -43,7 +43,7 @@ e7b33dc3a8b3c35424fe06cb6e2a7a8b *R/betadiver.R
 8da08aa374ef829ccd69302d71181dca *R/bioenv.default.R
 abe03a297a6200d9b48b38c6d92333aa *R/bioenv.formula.R
 4dbe9f135fadbba3f6939d64a5bb0e29 *R/biplot.CCorA.R
-a214c5bd1447e18f3b6118f850c1a7c3 *R/biplot.rda.R
+f22e634bf8399d7edb1fe05845921ccf *R/biplot.rda.R
 0999bb90f22b72fade2ca6adbd01758f *R/boxplot.betadisper.R
 dd03c1ef27bc56d056dc761fd7ecd153 *R/boxplot.specaccum.R
 cbf54233db3c2839101f98e02eb538dd *R/bstick.R
@@ -61,7 +61,7 @@ cfade23914ea7a85bd1edf32617dd497 *R/capscale.R
 2e09a82ec52e211afc2ac6e8d4b40898 *R/cca.R
 fe3b7320b434d46d2308d880ef26787a *R/cca.default.R
 e01e3acecdb9ac8d9195937e9879d126 *R/cca.formula.R
-f5a2789cc50349cb7ee3cec80bda6a1f *R/centroids.cca.R
+cb28d9e98ceba372f8eca9b1e5fc69a4 *R/centroids.cca.R
 c66d8fbe69ccca94f2ee8f777ff16ae2 *R/checkSelect.R
 6faf5d12f3e1abb40c0f8d2cfeabc4b4 *R/clamtest.R
 6ee5070eb4ec1a82e1dd59db5328fa41 *R/coef.cca.R
@@ -95,7 +95,7 @@ cf0a0bf7116ef7a21e090d0c1a76f8d0 *R/estimateR.data.frame.R
 1df3194c88598964282c114cb8db5513 *R/estimateR.matrix.R
 8a07a85be771af60a831d8b4ed3c8973 *R/eventstar.R
 5ad3db71edac392b0513ccb96700af0d *R/extractAIC.cca.R
-4833d9bfab4a5c585484b5d0a5a0ef34 *R/factorfit.R
+abb000be405120e4e8d0f562d74af473 *R/factorfit.R
 7e304b1c384c4d8588e5dbedd9459c73 *R/fieller.MOStest.R
 ee8330855e6a7bc2350047d76b2209a4 *R/fisher.alpha.R
 2776f68ef40e177303c3b73163036969 *R/fisherfit.R
@@ -136,19 +136,19 @@ a5d9b7fa31477efc0a1ff76a62988a8e *R/lines.procrustes.R
 f92ed9f1da4790e02a3fcfc1c199a539 *R/linestack.R
 1dcc7e0504b5468a3bb2253924901e50 *R/make.cepnames.R
 8a269b68b5abd56f36fdb59a8c142210 *R/make.commsim.R
-e4f3f842eee5e4812bdb47325aaf7396 *R/mantel.R
+f25f916c75667aa6eb64136817e79256 *R/mantel.R
 fdb2f4786b31866197c80d827584edaf *R/mantel.correlog.R
-963b77f33ee9c5152c358309a94cdddf *R/mantel.partial.R
+3e005ec1cc5a4231ee7c470cb30df01b *R/mantel.partial.R
 e054f13ad65a7f2616561c73557b412b *R/meandist.R
-57cb748570098b7e5a5aedbddb39fb84 *R/metaMDS.R
-26b26e400ead4cf3de31d7eab29c6984 *R/metaMDSdist.R
+18e8baa91c8536766ae5193e6478515f *R/metaMDS.R
+4b0744e9e9fa385991c9cafcf0abd222 *R/metaMDSdist.R
 0b5c1f0bdf937223613e4c6b6e74764e *R/metaMDSiter.R
 f63315501ad2f3a96dee9ee27a867131 *R/metaMDSredist.R
 928df675822d321e4533ba2b7cf0c79f *R/model.frame.cca.R
 9406148bd2cfa3e74b83adfe24858c46 *R/model.matrix.cca.R
-f746e66be6ac3ccc3be9cb4b4b375b4d *R/monoMDS.R
-8ccc51e88b6adf2d4aca1d192db65a6c *R/mrpp.R
-e145ba6b52ae375dc42b40e98e8b6594 *R/mso.R
+443471a651954a1869401c12d3936fe9 *R/monoMDS.R
+528542809ec4d03983643eaa92d3a4d9 *R/mrpp.R
+28dd509e9e35512169e010d30cfa635b *R/mso.R
 7e428f1adfdae287a1d64a79c6f2c3bc *R/msoplot.R
 7c219818ce5841e957db47f16986080b *R/multipart.R
 9b638597fb52736dc7c3b1c1e31f8726 *R/multipart.default.R
@@ -162,7 +162,7 @@ e7ddbbc85fd1a656e4343f5469621124 *R/nestedtemp.R
 74b2723851155de631716fa479f8ea38 *R/no.shared.R
 47973ff187f68836a19d20ea37c60868 *R/nobs.R
 9c89764ae10460148c1dcf9d25e05649 *R/nullmodel.R
-8909039c4fbff936278af7fc0506e406 *R/oecosimu.R
+a9b2db1c561cef462be0939cdcc2b090 *R/oecosimu.R
 7b3988a207ecfe1ea574c5857ffcd2a3 *R/orderingKM.R
 e3d108eed97633040fa22c2b384e19e4 *R/ordiArgAbsorber.R
 ffd002ae0ed83062dabb963f02f3c854 *R/ordiArrowMul.R
@@ -170,9 +170,9 @@ ffd002ae0ed83062dabb963f02f3c854 *R/ordiArrowMul.R
 1d06482d11f1e2ebd41a61a07ad97dd1 *R/ordiGetData.R
 99c1ec285e2afe4fb8beccbd507a123e *R/ordiNAexclude.R
 045e89399470e8c72a875570e1229bf2 *R/ordiParseFormula.R
-e2b5e5a2e5d99460cda76ea3b9d6ee42 *R/ordiR2step.R
+b091e26890dca94566654e06cb07d71b *R/ordiR2step.R
 7757339f5b8899cb54f13da274abda66 *R/ordiTerminfo.R
-005172ab8025d892cc93829b6933e95f *R/ordiareatest.R
+1989346a0f2bd9284ef442d1e2511c68 *R/ordiareatest.R
 e06d56a6e7d47767b9e71a73cbd3a80b *R/ordiarrows.R
 85f3047b80ab9a2ea57dd7935d07b583 *R/ordicloud.R
 793f91b9bf7c35f335949121d6f317c9 *R/ordicluster.R
@@ -199,10 +199,10 @@ bc3671e5b7a30e2849d3b59f65783c97 *R/orditorp.R
 baeed5122d5d27cc47b3fc00068895a8 *R/pcnm.R
 b5b164724f3872370bff36ef767f8efb *R/permatfull.R
 eeeaf4245033bd2a4ce822c919e42c6e *R/permatswap.R
-d52f29bac4af376721b75115da94fa9e *R/permustats.R
+5d610edd65b5f89db90704e191ed9100 *R/permustats.R
 3d6a5ecd5feab93db30c063fd144d422 *R/permuted.index.R
-94bae01fad2ee6f0380de55ffb90918a *R/permutest.betadisper.R
-2838084b8e5c948096ee5774d966bb8d *R/permutest.cca.R
+d2b4ce957bcc6376391f045b7046c697 *R/permutest.betadisper.R
+4230453c5955f4e777b20a8cd916efa7 *R/permutest.cca.R
 b4e77b98f86c4b567d687b64e3aa8812 *R/persp.renyiaccum.R
 b499c6eea710aa0c65a580dba30f2914 *R/persp.tsallisaccum.R
 f7c8d52c791489d956a7fd833913f242 *R/plot.MOStest.R
@@ -210,7 +210,7 @@ f7c8d52c791489d956a7fd833913f242 *R/plot.MOStest.R
 58d63201c7f61f455b0394b7a0e1235d *R/plot.betadisper.R
 de416206dba5566d70080bc14e86382e *R/plot.betadiver.R
 9023fd332556779fe9405e0714ec5dae *R/plot.cascadeKM.R
-b4f0bef610004ec69d8839db6b1791ce *R/plot.cca.R
+4981e07d470a1fc9843357dc8f453e19 *R/plot.cca.R
 61df47a15577f5ad882d2694bdd73d38 *R/plot.clamtest.R
 dc793c47c821ba2961bf284132997ba3 *R/plot.contribdiv.R
 0ab3b62ac155ede193867f43640dbd34 *R/plot.decorana.R
@@ -227,7 +227,7 @@ df06e0f9bd4bc8a546adf466c6daeca6 *R/plot.ordipointlabel.R
 da30b6ae5fd0e30543f18064cf19b54a *R/plot.orditkplot.R
 7e136913597f9f78ac069be6a5a3f465 *R/plot.permat.R
 38e6ae320c35fe9d9fbc32c5bf4d5880 *R/plot.poolaccum.R
-fdc1beae72f52a43883861a8b56bf289 *R/plot.prc.R
+1b2e85f077d763fdd9c25b3deffde543 *R/plot.prc.R
 6cd9c1a91d03a8afb8f9148f0d369cad *R/plot.preston.R
 31b95161a7558e111e3c01778b9d17db *R/plot.prestonfit.R
 5159170150e3c6d1ed92b5c3ec984b75 *R/plot.procrustes.R
@@ -242,7 +242,7 @@ d668dd7351acfcbfa686fea4ddb85218 *R/plot.specaccum.R
 abc96c8853871035d494dfa9086d4d6e *R/plot.taxondive.R
 6104fadf391072e78a8f2825ac41ceb2 *R/plot.varpart.R
 00d109fe7fc29440698b9f1a4bbc876f *R/plot.varpart234.R
-aa2199fd5eb25caaec83e7134e0b6bd4 *R/points.cca.R
+54a640830bf34d4e5e5d232510f70300 *R/points.cca.R
 3fbe4782d2c376d98f23db8890c42b3b *R/points.decorana.R
 b5661457c540b56e77eba97b8b290a91 *R/points.humpfit.R
 a0e1e2d579fa8c1992a26a2e8d435750 *R/points.metaMDS.R
@@ -253,12 +253,12 @@ e352171f478eb27cf4a875cc3a1693fc *R/points.orditkplot.R
 06defcf59464ba92af271dca87943029 *R/poolaccum.R
 91aa7fd2fbd99f8e325932d59886dac7 *R/postMDS.R
 f9dcd972e5c81ce936c9ec5b296d484c *R/prc.R
-32a52d09ade017e52d96eb56c05904c3 *R/predict.cca.R
+ca38da30d3e3d1e91d5534ec6b885834 *R/predict.cca.R
 049f41cca1b39bf0a221723855cffcff *R/predict.decorana.R
 ca99e94ed4bc39135b84f61ed64bf9fd *R/predict.fitspecaccum.R
 06cca728e43d29da2528b01dccb26962 *R/predict.humpfit.R
 3eaaaf25580077e7dff217c3f237e37a *R/predict.radline.R
-35a61b21f7ff4d24451aff811add56d7 *R/predict.rda.R
+fe5ea19cd8e2f6bf7cfa822b58ff9ece *R/predict.rda.R
 6b10b84b569e5eed32629912b19e9c8b *R/predict.specaccum.R
 4f56d16f5bf8f9af3477c23137a70fb5 *R/pregraphKM.R
 81bb150e264f7da07989c909f4531a45 *R/prepanel.ordi3d.R
@@ -271,7 +271,7 @@ dbce7c674b2e53109295fc280e96356c *R/print.anosim.R
 a530724906dc69888c27a538fc388cbf *R/print.betadisper.R
 2f1f189154aec84360211e3ae195693d *R/print.bioenv.R
 528c225f34769670a4a3049a0e29ae59 *R/print.capscale.R
-1cf9b8849f2c410a543ce35bcc4650af *R/print.cca.R
+3b989d330c0f95eff362eee77405b2c7 *R/print.cca.R
 a88f54aacef2ff5cdfa99215de346349 *R/print.commsim.R
 6d0cd7929afcbe0d192c980dc5196555 *R/print.decorana.R
 65e888e34fa8a8e1d5b577fbadb3161a *R/print.envfit.R
@@ -294,7 +294,7 @@ eed481e994c01ec4d7b443fb8cafad46 *R/print.nesteddisc.R
 6bc910829bc129ceb8c357e143af4835 *R/print.oecosimu.R
 39c3d65d6a6b2a68f974e936cc6232ae *R/print.permat.R
 fd6136405300e42e73d4850a338505e3 *R/print.permutest.betadisper.R
-d661319e28299f31403b738235f6e7aa *R/print.permutest.cca.R
+472da38cd012a272d6feecbecd5cd648 *R/print.permutest.cca.R
 a01e4eeb80a020c9e516f47f559baa98 *R/print.poolaccum.R
 c0f0559d9f53c8635bba01f1f90b7cc3 *R/print.prestonfit.R
 4abe25d64d3e55ef83ece3691f77f900 *R/print.procrustes.R
@@ -323,7 +323,7 @@ db1dc929d679ce1641c6a7d319091e2c *R/print.summary.permat.R
 083d526f54611d40ce749ffe95f169ae *R/procrustes.R
 819af0297e5d0a907f7fa91319c67e96 *R/profile.MOStest.R
 2f6b69115ea549102dad9b1b22c88034 *R/profile.humpfit.R
-a46a4071a273af8bea01b5ef29b96f54 *R/protest.R
+384ed8e04e1da5b92108d859f4feb315 *R/protest.R
 9169bd797963b5b121684de528651170 *R/rad.lognormal.R
 b129148e6efbbe1c45482c93d66f959b *R/rad.null.R
 949aca6b5bb7954a91819b17e515e396 *R/rad.preempt.R
@@ -334,7 +334,7 @@ b129148e6efbbe1c45482c93d66f959b *R/rad.null.R
 2f6d8082f39540bbe7cf0e0cf3c666c9 *R/radfit.default.R
 36cfb246e391a7434c714fbb2269cdb6 *R/radlattice.R
 7608e7f23ebe04e3a7ea6e5fe384c431 *R/rankindex.R
-44ead773a0ceaafae24e92523e48f799 *R/rarecurve.R
+4b9d8d8e7c684ec95d0676f6dabb354f *R/rarecurve.R
 3afd2bf3e85bdc553ef5e24436a4788b *R/rarefy.R
 9c65025c61d4c25ce25234533e7b14c6 *R/rareslope.R
 d9a219ae6f3e6155ae76bc59d3e14d30 *R/raupcrick.R
@@ -347,10 +347,11 @@ a36c4cc88624a9e45103f656f9eaa491 *R/renyiaccum.R
 90a897e14094cc1eba66c5f59a5bb79c *R/residuals.cca.R
 38df11064481bc21f8555152cfd3d115 *R/residuals.procrustes.R
 4ffd3879dcf18d0bdef8ffc8bf5b8ad3 *R/rrarefy.R
+c94cf53d2345f590de45c0f9db6fe272 *R/scalingUtils.R
 ed66f1e11f53f7fbdbd8663de2b7f5dd *R/scores.R
 d46cc2163dbc117a978f64d54df7bbd4 *R/scores.betadisper.R
 341ee43f8524dccb5e369513a16923b1 *R/scores.betadiver.R
-ff0869aabee96b7d208a75121a6e01e7 *R/scores.cca.R
+6052d447e0b7e6a8605629055fd2c5d0 *R/scores.cca.R
 447810692c53fab8cd6907ec920e0852 *R/scores.decorana.R
 d7485aeb982d12832c96f54a47dff2f4 *R/scores.default.R
 6415eb8600a7e516ae6c053832c45357 *R/scores.envfit.R
@@ -360,13 +361,13 @@ e4b321e08dfaaf89bd548af364902738 *R/scores.ordihull.R
 f146575a3f60358567dfed56e8cbb2cd *R/scores.ordiplot.R
 512cedf50891372019cae370b240a742 *R/scores.orditkplot.R
 4755a38c8b83b76f123b8e84cf47b700 *R/scores.pcnm.R
-14bb630e0f917d671f6ae9671f3ca5cf *R/scores.rda.R
+d703f32e3ad9459232643e2293edf9d4 *R/scores.rda.R
 42e3e9222d18a33abb561bac1db5bc6f *R/screeplot.cca.R
 71a7f620655b068c3a53561fc16bfd39 *R/screeplot.decorana.R
 3fe910b739d447ba5026f077cb0c670d *R/screeplot.prcomp.R
 66d8c6dfecb51ca1afdf309926c00d08 *R/screeplot.princomp.R
 96e51f8fd78641579487ed079ee51170 *R/showvarparts.R
-f77b038c96449c8ea1964bde35b6792d *R/simper.R
+ea0a7e941a445235273790efa4b295b9 *R/simper.R
 b35ee7d9cdc86eecefb5dcf478fc8abf *R/simpleRDA2.R
 6670475eff913b3586560d4b2ec65149 *R/simulate.nullmodel.R
 a5e793142ae74276a02e761cfe255f22 *R/simulate.rda.R
@@ -384,7 +385,7 @@ bd2d1d998f18e7a9c65d5072932cbef2 *R/str.nullmodel.R
 f687d03b090a0962026ca60272ab90d5 *R/stressplot.wcmdscale.R
 55b28298153f00b4c1f8574b0784eb0c *R/summary.anosim.R
 19ce7c501fff2cacc8ad322fd0500a48 *R/summary.bioenv.R
-3a83c24d81c46f07afdd854a2c0193ef *R/summary.cca.R
+7fea8ad8bbbfb61348faaa76ea44725b *R/summary.cca.R
 c1f7a5045e57ac95c9ae7f13f2a11743 *R/summary.clamtest.R
 bf8be2e9b02c1a3cd5f3ad0005e8354c *R/summary.decorana.R
 088b8c747d67fa5ad158304a21f32628 *R/summary.dispweight.R
@@ -395,7 +396,7 @@ bf8be2e9b02c1a3cd5f3ad0005e8354c *R/summary.decorana.R
 27c7f052d2d9674d898f0aa3d741a8c4 *R/summary.ordihull.R
 11578277712acd07ebb5f7c66c0a47b8 *R/summary.permat.R
 3ef798c28399894f4bf0ba649360e69e *R/summary.poolaccum.R
-71609e72f80900e7c461440336c98c97 *R/summary.prc.R
+4db5bd385c6c52e7c370647f0fc0abc8 *R/summary.prc.R
 a8c1bf3d3f371f3ee5a3de3c39a4113a *R/summary.procrustes.R
 1a7820db6bf56e31bcc85d3a91f1a831 *R/summary.radfit.frame.R
 25e8a947666bed660358e359730160d9 *R/summary.specaccum.R
@@ -404,13 +405,13 @@ a8c1bf3d3f371f3ee5a3de3c39a4113a *R/summary.procrustes.R
 c2c3f2005758d438c6f2815ab2495d5d *R/tabasco.R
 62bc8a0693a71adb1457b0a102d8951a *R/taxa2dist.R
 90ec6192eb43f8fd29bc93485f4ef293 *R/taxondive.R
-3f933def4e4dbe3792be7c977c5612b5 *R/text.cca.R
+c103958b08a39e45f44ed5b55c380d25 *R/text.cca.R
 1f4d9ba97695c0fa99456f427114b049 *R/text.decorana.R
 6a6e426f6e464bb7bdaa75d92674562c *R/text.metaMDS.R
 974bdc93cd9b352d30debf3e93111136 *R/text.ordiplot.R
 846003f5f9de23241805042ac459ed1d *R/text.orditkplot.R
 0fc7a75cf414d76cc751cc33ed5d6384 *R/tolerance.R
-a0c720c309192c5264b12685c490051d *R/tolerance.cca.R
+7a3aedecb5fc64e07b919d867321a4ba *R/tolerance.cca.R
 7b45ffae615add899174090372c90188 *R/treedist.R
 1400038a7df6468da830bc75782d3873 *R/treedive.R
 cf0f2cbf17bbd944d455f71918ab88eb *R/treeheight.R
@@ -421,7 +422,7 @@ cf0f2cbf17bbd944d455f71918ab88eb *R/treeheight.R
 8d09b6b6390c2866234763beae855cf3 *R/varpart2.R
 77fef5d5355715c9928edd3b9995d415 *R/varpart3.R
 7f4f5d715a9b3e1a916f72ffbfebcc19 *R/varpart4.R
-21b6af9e9d96c2fb4c642894efc82227 *R/vectorfit.R
+1486696c7f5277981e34aa33c50945c9 *R/vectorfit.R
 6f433537ff5ce5811a0ca8c4ac4c729d *R/vegan-defunct.R
 593e3e9774284bfc0362a5c0b0b2fbcc *R/vegan-deprecated.R
 129a1cf5e913a365ffd679b63378811b *R/veganCovEllipse.R
@@ -439,6 +440,7 @@ ecfd48e2f4df6bcd683a87203dd80e12 *R/weights.cca.R
 4138f57726620d493f218e5e3da0013c *R/wisconsin.R
 17cbf4b5c186fe577cf361f0254df1d6 *R/zzz.R
 5aade318f4f03a71719d64ab1887b212 *build/vignette.rds
+45a61c1583ecb67f7191a0b0be901a77 *data/BCI.env.rda
 0f283f2be37fdfec65ec6e5b0146889c *data/BCI.rda
 412ea5cf443401fe54f0b14c14c45806 *data/dune.env.rda
 b0a8834b45c79fc017717838d700f0f6 *data/dune.phylodis.rda
@@ -453,41 +455,41 @@ ee3c343418d7cf2e435028adf93205f1 *data/sipoo.rda
 f87df84297865b5faf31e232e97a0f94 *data/varechem.rda
 7136b8666250a538d60c88869390a085 *data/varespec.rda
 1fb35aec7042529e18e4673818fecf7f *inst/ChangeLog
-5d6f9f8b9e21a4ea373a65c768e61e77 *inst/NEWS.Rd
+231bbdc502baaee9a6b80356a5d51921 *inst/NEWS.Rd
 9abfab8b05c34dd283379a7d87500ffb *inst/ONEWS
-ba1331631c44717ac0e59a4ffc16a08f *inst/doc/FAQ-vegan.pdf
-58b91b511b3c9ac636939922d56e1fda *inst/doc/NEWS.html
+194655c013a9a2839753e00575c8e7e9 *inst/doc/FAQ-vegan.pdf
+13e6253c9f4dec73158cf434a250d7e7 *inst/doc/NEWS.html
 e3e19be6e4226ef4b943c5dd46c3e161 *inst/doc/decision-vegan.R
 09c81618a5a91cbfc5e8c3d969dc63fd *inst/doc/decision-vegan.Rnw
-644a859cdf89e40e992acb47606dc684 *inst/doc/decision-vegan.pdf
+81876be3de1e6199d6258f401b7ed523 *inst/doc/decision-vegan.pdf
 41fae44349a8a602825bddba8750102d *inst/doc/diversity-vegan.R
 06cfa11a83ca0330979d500549f2415a *inst/doc/diversity-vegan.Rnw
-f7c38db5a9a23158a1f8191bc4175a8f *inst/doc/diversity-vegan.pdf
+a2e447b29cea2361c51706a77f8d5328 *inst/doc/diversity-vegan.pdf
 42c6873fda4c73ed0ccdeddef41563b2 *inst/doc/intro-vegan.R
 ddee3279ac0982a3da0bcf9fc10947ac *inst/doc/intro-vegan.Rnw
-f2d01c31f13578429ecd29e6fe8d60f8 *inst/doc/intro-vegan.pdf
+d561dab81fbc28b5b51a85e664d49321 *inst/doc/intro-vegan.pdf
 a1c35ea488b715441cd2269eb6998945 *inst/doc/partitioning.pdf
-5037564d03aeac297d52c412762ffed8 *man/BCI.Rd
+fa807ecb01eb4910956e4e1f5f29c437 *man/BCI.Rd
 d4d97e3b71561f61bd9f1f0686a57434 *man/CCorA.Rd
 e540cd18b5f99d385a8d2945052dc70e *man/MDSrotate.Rd
 fd218be03aa2591e5123d11780ccba1a *man/MOStest.Rd
 f2823a48acb6f861404b6682b3f52a45 *man/RsquareAdj.Rd
 73f141f28a1aca961cd4e992d8610934 *man/SSarrhenius.Rd
 32f805196e58b526c3a2bab5c87116b3 *man/add1.cca.Rd
-582f8fe9738d853476565f57e72862de *man/adipart.Rd
+d4395104c6b5d4e6fae91324cb817559 *man/adipart.Rd
 caf191d6c5c1e618e11cb8d7441407b4 *man/adonis.Rd
 9a341d0716f7d6cc46b427d7cc017d2d *man/anosim.Rd
-193d8a15c966cc0d5d9a71008a29eca7 *man/anova.cca.Rd
+5b83e39817e231c0a01c8496fcde00dc *man/anova.cca.Rd
 c57af27fa11dadcd48981fcf42b2d221 *man/as.mlm.Rd
 8e3718248ff8d48e724654ab17caa2e2 *man/beals.Rd
 f17b3ca5ef9b2e18cce9688b806e59f6 *man/betadisper.Rd
 1336f0afb69a05bee9f6e7706d81d038 *man/betadiver.Rd
 b04c2fae35dba2d97cb248814d5e2fe9 *man/bgdispersal.Rd
 860b9c7f2325f500c27f3c903831efae *man/bioenv.Rd
-1eab4a6369fa1d203a4a3f41f4ee4c06 *man/biplot.rda.Rd
+783cc695729b9ce5ce9331944337541f *man/biplot.rda.Rd
 88602656153ee95f10335487273e132d *man/capscale.Rd
 644e253ebcab91a5ddce85294dda278d *man/cascadeKM.Rd
-ee2214609df58c9a26b87e66260fa8c6 *man/cca.Rd
+56460c2a89a5c140945015515a7093d3 *man/cca.Rd
 9a2708af1831b9ddce1004971b6f4efc *man/cca.object.Rd
 d808372c406b8d0ede9e26623655ac08 *man/clamtest.Rd
 362992febcb1479b750a995203626e40 *man/commsim.Rd
@@ -499,7 +501,7 @@ c01e0664652fbc8ef4963059bee4e422 *man/deviance.cca.Rd
 f58b474141a1b0fdf438bfe6dd8da0c9 *man/dispindmorisita.Rd
 70c0ef1ef267a37e2677476a43b72265 *man/dispweight.Rd
 f3f742efa7511a4c33108a00b512ebd9 *man/distconnected.Rd
-509705abf758024dafadabce9a2604a8 *man/diversity.Rd
+7d05cf2b4cb7fbaec9e37b7fa3a3d981 *man/diversity.Rd
 08b96c1a45c11ffcb7f0da33a888421a *man/dune.Rd
 91fa409075b3bd64706c8ff380b3d01d *man/dune.taxon.Rd
 5f5f8c7df063606ccde6124c5dbe8add *man/eigenvals.Rd
@@ -519,7 +521,7 @@ f8d6f3bd27a07dc00c6779405652ec07 *man/mantel.Rd
 e598d23fdc8a162bb793a3aa774559b9 *man/metaMDS.Rd
 4cfb02239809fa03b28e10ec8e8c9c6b *man/mite.Rd
 c50bd45c9e8c6e892d2dd8f7fe5f0bd9 *man/model.matrix.cca.Rd
-a53ce6074ce0cc6e627955be31d5664f *man/monoMDS.Rd
+599ee1759c06b4171a363f3de6a4438c *man/monoMDS.Rd
 b897a6552d7524c853e91f9d8b972cb6 *man/mrpp.Rd
 181ca1c040aff6f79fca96d4c0b9708c *man/mso.Rd
 10d5049f8819e378f7f95fdb3858e6e7 *man/multipart.Rd
@@ -541,16 +543,17 @@ da0b3d8e0681a5ddc2bea83fd1796048 *man/ordistep.Rd
 d971701b3c6f89b3a6b358a3966a43d2 *man/ordixyplot.Rd
 e8a307f119251e6651dacf18c182f73f *man/pcnm.Rd
 d3fd306546c43339ad7d8fd985a28801 *man/permatfull.Rd
-c9b31c8a90d2b0e282e15e03af5d3ae8 *man/permustats.Rd
+0c3dc2962707c6a19910a579e2ac0f01 *man/permustats.Rd
 4a2ed8481b1f6805d343e83fda91e0ed *man/permutations.Rd
 10e7cc018db792a9c75f3cad7ca3e999 *man/permutest.betadisper.Rd
-47898b675bb6d36fce6961e6a70d8d57 *man/plot.cca.Rd
-242e814ce0a68af785e499a9dbc5d078 *man/prc.Rd
-37cad2f61855e0cc430943ac98885069 *man/predict.cca.Rd
+49199ad9a05e646a479d423ad159ddf1 *man/plot.cca.Rd
+d45a85e1ccef663ad3bc6d87286f5904 *man/prc.Rd
+59371b694baddaa44f8a2dba9a741057 *man/predict.cca.Rd
 f07f175a660698d334d2628927b85380 *man/procrustes.Rd
 01a6ca946df5ad493adfb54003ad8e00 *man/pyrifos.Rd
 f61f64cc1be643149fd02f08a0cd7f9f *man/radfit.Rd
 8b12fb04530537414e03e1a6fbccda7c *man/rankindex.Rd
+5bdd04a6b3f023f5b4e326101a19824f *man/rarefy.Rd
 915c6ea3098d6ac9c3de6249606b2fe9 *man/raupcrick.Rd
 2867f5f71a47da498cbadf9aaa01b2b6 *man/read.cep.Rd
 87cf4ea35d498647e8848f487041add7 *man/renyi.Rd
@@ -561,12 +564,12 @@ fa4c03b6622b3cba08b633393560b70a *man/simper.Rd
 621f8a2810727ab3523fc0bd69a56dca *man/simulate.rda.Rd
 2a9336794ae5a322bf2ce6b71edb3f0c *man/sipoo.Rd
 37121fc0a195e97b3b1287678d175bab *man/spantree.Rd
-ed1dfc98575b9a1a74590172cf9d7c4f *man/specaccum.Rd
+0858ab26917c2c5ca8704d690a28874b *man/specaccum.Rd
 300a45ac7b4b61992707bb60658fa915 *man/specpool.Rd
 5b9e51c85395f80f8504954e4175f877 *man/stepacross.Rd
 812fedada0ae3582c28f4f91bbcedc09 *man/stressplot.wcmdscale.Rd
 0aac5f5c8f58fc8fe1cb6c0ba819b196 *man/taxondive.Rd
-85f77fcf89b48586502c00baef8e5561 *man/tolerance.Rd
+21d5137a2335a80efddff8dc9c55370f *man/tolerance.Rd
 a4b37297402220dee75997c4f49a729c *man/treedive.Rd
 14cc64af5f8a8c5965563a2b03c408f2 *man/tsallis.Rd
 033dd7d7917185cea81e4d7afcd59df9 *man/varechem.Rd
@@ -590,15 +593,15 @@ a42c4629717137858295a1eb6f3e89de *src/nestedness.c
 31bdbe9b08340e1662a62cf6e61ade6a *src/pnpoly.c
 b9b647fcf8a3e59e10b9351fae60ec06 *src/stepacross.c
 36ea09c9a6553010e786f0e787185d60 *src/vegdist.c
-ba1331631c44717ac0e59a4ffc16a08f *vignettes/FAQ-vegan.pdf
+194655c013a9a2839753e00575c8e7e9 *vignettes/FAQ-vegan.pdf
 091bacdffea4d9e22aedc8b37c7872d7 *vignettes/FAQ-vegan.texi
 45ce50de9edf3aeacd8d11d1483f764c *vignettes/Makefile
-58b91b511b3c9ac636939922d56e1fda *vignettes/NEWS.html
+13e6253c9f4dec73158cf434a250d7e7 *vignettes/NEWS.html
 09c81618a5a91cbfc5e8c3d969dc63fd *vignettes/decision-vegan.Rnw
-f3a6cde88199828c5ebc0efa05a9c384 *vignettes/decision-vegan.tex
+410c482eece0b913054843f8de2ee499 *vignettes/decision-vegan.tex
 06cfa11a83ca0330979d500549f2415a *vignettes/diversity-vegan.Rnw
-92cf5c2f3015356dec6c0ed9bc69e4e2 *vignettes/diversity-vegan.tex
+6f37b6c7a98184ab8760040833a4c034 *vignettes/diversity-vegan.tex
 ddee3279ac0982a3da0bcf9fc10947ac *vignettes/intro-vegan.Rnw
-17309ce03e033dec684706b6b2abada2 *vignettes/intro-vegan.tex
+e8b9922b6c54d0a726f038e40ad9c938 *vignettes/intro-vegan.tex
 2004d867a35c1fb405934004d121fa9a *vignettes/vegan.bib
 fd58fa43e5e36d0ddcddd26dac1c7e31 *vignettes/vegan.sty
diff --git a/NAMESPACE b/NAMESPACE
index 7340751..aa7761b 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -73,8 +73,9 @@ S3method(densityplot, oecosimu)
 import(stats)
 import(graphics)
 import(permute)
-importFrom(utils, head, tail, str)
+importFrom(utils, browseURL, combn, flush.console, head, object.size, tail, str)
 importFrom(tools, Rd2txt, startDynamicHelp)
+import(grDevices) ## too many functions to be listed separately
 import(lattice)
 importFrom(parallel, mclapply, makeCluster, stopCluster, clusterEvalQ,
            parApply, parLapply, parSapply, parRapply, parCapply)
@@ -253,6 +254,7 @@ S3method(permustats, ordiareatest)
 S3method(permustats, permutest.betadisper)
 S3method(permustats, permutest.cca)
 S3method(permustats, protest)
+S3method(permustats, anova.cca)
 ## these return an error: no permutation data
 S3method(permustats, CCorA)
 S3method(permustats, envfit)
diff --git a/R/adonis.R b/R/adonis.R
index 38c7852..704317a 100644
--- a/R/adonis.R
+++ b/R/adonis.R
@@ -3,6 +3,7 @@
              contr.unordered="contr.sum", contr.ordered="contr.poly",
              parallel = getOption("mc.cores"), ...)
 {
+    EPS <- sqrt(.Machine$double.eps) ## use with >= in permutation P-values
     ## formula is model formula such as Y ~ A + B*C where Y is a data
     ## frame or a matrix, and A, B, and C may be factors or continuous
     ## variables.  data is the data frame from which A, B, and C would
@@ -132,13 +133,10 @@
         ## Close socket cluster if created here
         if (isParal && !isMulticore && !hasClus)
             stopCluster(parallel)
-        ## Round to avoid arbitrary P-values with tied data
-        f.perms <- round(f.perms, 12)
-        P <- (rowSums(t(f.perms) >= F.Mod)+1)/(permutations+1)
+        P <- (rowSums(t(f.perms) >= F.Mod - EPS)+1)/(permutations+1)
     } else { # no permutations
         f.perms <- P <- rep(NA, nterms)
     }
-    F.Mod <- round(F.Mod, 12)
     SumsOfSqs = c(SS.Exp.each, SS.Res, sum(SS.Exp.each) + SS.Res)
     tab <- data.frame(Df = c(df.Exp, df.Res, n-1),
                       SumsOfSqs = SumsOfSqs,
diff --git a/R/alias.cca.R b/R/alias.cca.R
index c17104b..3fa575d 100644
--- a/R/alias.cca.R
+++ b/R/alias.cca.R
@@ -1,8 +1,10 @@
 `alias.cca` <-
     function (object, names.only = FALSE, ...) 
 {
-    if (is.null(object$CCA$alias))
+    if (is.null(object$CCA))
         stop("no constrained component, 'alias' cannot be applied")
+    if (is.null(object$CCA$alias))
+        stop("no aliased terms")
     if (names.only)
         return(object$CCA$alias)
     CompPatt <- function(x, ...) {
diff --git a/R/anosim.R b/R/anosim.R
index c179373..dba93b3 100644
--- a/R/anosim.R
+++ b/R/anosim.R
@@ -2,6 +2,7 @@
     function (dat, grouping, permutations = 999,
               distance = "bray", strata = NULL, parallel = getOption("mc.cores")) 
 {
+    EPS <- sqrt(.Machine$double.eps)
     if (inherits(dat, "dist")) 
         x <- dat
     else if (is.matrix(dat) && nrow(dat) == ncol(dat) && all(dat[lower.tri(dat)] == 
@@ -65,7 +66,7 @@
         } else {
             perm <- sapply(1:permutations, function(i) ptest(permat[i,]))
         }
-        p.val <- (1 + sum(perm >= statistic))/(1 + permutations)
+        p.val <- (1 + sum(perm >= statistic - EPS))/(1 + permutations)
     } else { # no permutations
         p.val <- perm <- NA
     }
diff --git a/R/anova.cca.R b/R/anova.cca.R
index 4da0f48..5531604 100644
--- a/R/anova.cca.R
+++ b/R/anova.cca.R
@@ -4,6 +4,7 @@
              parallel = getOption("mc.cores"), strata = NULL,
              cutoff = 1, scope = NULL)
 {
+    EPS <- sqrt(.Machine$double.eps) # for permutation P-values
     model <- match.arg(model)
     ## permutation matrix
     N <- nrow(object$CA$u)
@@ -58,16 +59,21 @@
     tst <- permutest.cca(object, permutations = permutations,
                          model = model, parallel = parallel, ...)
     Fval <- c(tst$F.0, NA)
-    Pval <- (sum(tst$F.perm >= tst$F.0) + 1)/(tst$nperm + 1)
+    Pval <- (sum(tst$F.perm >= tst$F.0 - EPS) + 1)/(tst$nperm + 1)
     Pval <- c(Pval, NA)
     table <- data.frame(tst$df, tst$chi, Fval, Pval)
-    is.rda <- inherits(object, "rda")
-    colnames(table) <- c("Df", ifelse(is.rda, "Variance", "ChiSquare"),
-                         "F", "Pr(>F)")
+    if (inherits(object, "capscale") &&
+        (object$adjust != 1 || is.null(object$adjust)))
+        varname <- "SumOfSqs"
+    else if (inherits(object, "rda"))
+        varname <- "Variance"
+    else
+        varname <- "ChiSquare"
+    colnames(table) <- c("Df", varname, "F", "Pr(>F)")
     head <- paste0("Permutation test for ", tst$method, " under ",
                   tst$model, " model\n", howHead(control))
     mod <- paste("Model:", c(object$call))
     structure(table, heading = c(head, mod), Random.seed = seed,
-              control = control,
+              control = control, F.perm = tst$F.perm,
               class = c("anova.cca", "anova", "data.frame"))
 }
diff --git a/R/anova.ccabyterm.R b/R/anova.ccabyterm.R
index a11fc09..76f4841 100644
--- a/R/anova.ccabyterm.R
+++ b/R/anova.ccabyterm.R
@@ -17,9 +17,9 @@
     trmlab <- trmlab[trmlab %in% attr(terms(object$terminfo),
                                       "term.labels")]
     ntrm <- length(trmlab)
-    m0 <- update(object, paste(".~.-", paste(trmlab, collapse="-")))
+    m0 <- update(object, paste(".~.-", paste(trmlab, collapse = "-")))
     mods <- list(m0)
-    for(i in seq_along(trmlab)) {
+    for (i in seq_along(trmlab)) {
         fla <- paste(". ~ . + ", trmlab[i])
         mods[[i+1]] <- update(mods[[i]], fla)
     }
@@ -27,13 +27,18 @@
     sol <- anova.ccalist(mods, permutations = permutations,
                          model = model, parallel = parallel)
     ## Reformat
-    out <- data.frame(c(sol[-1,3], sol[ntrm+1,1]),
-                      c(sol[-1,4], sol[ntrm+1,2]),
-                      c(sol[-1,5], NA),
-                      c(sol[-1,6], NA))
-    isRDA <- inherits(object, "rda")
-    colnames(out) <- c("Df", ifelse(isRDA, "Variance", "ChiSquare"),
-                       "F", "Pr(>F)")
+    out <- data.frame(c(sol[-1, 3], sol[ntrm+1, 1]),
+                      c(sol[-1, 4], sol[ntrm+1, 2]),
+                      c(sol[-1, 5], NA),
+                      c(sol[-1, 6], NA))
+    if (inherits(object, "capscale") &&
+        (object$adjust != 1 || is.null(object$adjust)))
+        varname <- "SumOfSqs"
+    else if (inherits(object, "rda"))
+        varname <- "Variance"
+    else
+        varname <- "ChiSquare"
+    colnames(out) <- c("Df", varname, "F", "Pr(>F)")
     rownames(out) <- c(trmlab, "Residual")
     head <- paste0("Permutation test for ", object$method, " under ",
                    model, " model\n",
@@ -41,7 +46,8 @@
                    howHead(attr(permutations, "control")))
     mod <- paste("Model:", c(object$call))
     attr(out, "heading") <- c(head, mod)
-    class(out) <- c("anova","data.frame")
+    attr(out, "F.perm") <- attr(sol, "F.perm")
+    class(out) <- c("anova.cca", "anova","data.frame")
     out
 }
 
@@ -51,6 +57,7 @@
 `anova.ccabymargin` <-
     function(object, permutations, scope, ...)
 {
+    EPS <- sqrt(.Machine$double.eps)
     nperm <- nrow(permutations)
     ## Refuse to handle models with missing data
     if (!is.null(object$na.action))
@@ -62,7 +69,7 @@
         trms <- drop.scope(object)
     trmlab <- trms[trms %in% attr(terms(object$terminfo),
                                       "term.labels")]
-    if(length(trmlab) == 0)
+    if (length(trmlab) == 0)
         stop("the scope was empty: no available marginal terms")
     ## baseline: all terms
     big <- permutest(object, permutations, ...)
@@ -85,18 +92,23 @@
     Fval <- sapply(mods, function(x) x$num)
     ## Had we an empty model we need to clone the denominator
     if (length(Fval) == 1)
-        Fval <- matrix(Fval, nrow=nperm)
+        Fval <- matrix(Fval, nrow = nperm)
     Fval <- sweep(-Fval, 1, big$num, "+")
     Fval <- sweep(Fval, 2, Df, "/")
     Fval <- sweep(Fval, 1, scale, "/")
     ## Simulated P-values
-    Pval <- (colSums(sweep(Fval, 2, Fstat, ">=")) + 1)/(nperm + 1)
+    Pval <- (colSums(sweep(Fval, 2, Fstat - EPS, ">=")) + 1)/(nperm + 1)
     ## Collect results to anova data.frame
     out <- data.frame(c(Df, dfbig), c(Chisq, chibig),
                       c(Fstat, NA), c(Pval, NA))
-    isRDA <- inherits(object, "rda")
-    colnames(out) <- c("Df", ifelse(isRDA, "Variance", "ChiSquare"),
-                       "F", "Pr(>F)")
+    if (inherits(object, "capscale") &&
+        (object$adjust != 1 || is.null(object$adjust)))
+        varname <- "SumOfSqs"
+    else if (inherits(object, "rda"))
+        varname <- "Variance"
+    else
+        varname <- "ChiSquare"
+    colnames(out) <- c("Df", varname, "F", "Pr(>F)")
     rownames(out) <- c(trmlab, "Residual")
     head <- paste0("Permutation test for ", object$method, " under ",
                    mods[[1]]$model, " model\n",
@@ -104,7 +116,8 @@
                    howHead(attr(permutations, "control")))
     mod <- paste("Model:", c(object$call))
     attr(out, "heading") <- c(head, mod)
-    class(out) <- c("anova", "data.frame")
+    attr(out, "F.perm") <- Fval
+    class(out) <- c("anova.cca", "anova", "data.frame")
     out
 }
 
@@ -113,6 +126,7 @@
 `anova.ccabyaxis` <-
     function(object, permutations, model, parallel, cutoff = 1)
 {
+    EPS <- sqrt(.Machine$double.eps)
     nperm <- nrow(permutations)
     ## Observed F-values and Df
     eig <- object$CCA$eig
@@ -124,10 +138,10 @@
     ## missing values?
     if (!is.null(object$na.action))
         LC <- napredict(structure(object$na.action,
-                                  class="exclude"), LC)
+                                  class = "exclude"), LC)
     ## subset?
     if (!is.null(object$subset)) {
-        tmp <- matrix(NA, nrow=length(object$subset),
+        tmp <- matrix(NA, nrow = length(object$subset),
                       ncol = ncol(LC))
         tmp[object$subset,] <- LC
         LC <- tmp
@@ -136,6 +150,7 @@
     LC <- as.data.frame(LC)
     fla <- reformulate(names(LC))
     Pvals <- rep(NA, length(eig))
+    F.perm <- matrix(ncol = length(eig), nrow = nperm)
     environment(object$terms) <- environment()
     for (i in seq_along(eig)) {
         part <- paste("~ . +Condition(",
@@ -150,22 +165,29 @@
                 permutest(update(object, upfla, data = LC),
                           permutations, model = model,
                           parallel = parallel)
-        Pvals[i] <- (sum(mod$F.perm >= mod$F.0) + 1)/(nperm+1)
+        Pvals[i] <- (sum(mod$F.perm >= mod$F.0) + 1) / (nperm + 1)
+        F.perm[ , i] <- mod$F.perm
         if (Pvals[i] > cutoff)
             break
     }
     out <- data.frame(c(Df, resdf), c(eig, object$CA$tot.chi),
                       c(Fstat, NA), c(Pvals,NA))
     rownames(out) <- c(names(eig), "Residual")
-    isRDA <- inherits(object, "rda")
-    colnames(out) <- c("Df", ifelse(isRDA, "Variance", "ChiSquare"),
-                       "F", "Pr(>F)")
+    if (inherits(object, "capscale") &&
+        (object$adjust != 1 || is.null(object$adjust)))
+        varname <- "SumOfSqs"
+    else if (inherits(object, "rda"))
+        varname <- "Variance"
+    else
+        varname <- "ChiSquare"
+    colnames(out) <- c("Df", varname, "F", "Pr(>F)")
     head <- paste0("Permutation test for ", object$method, " under ",
                    model, " model\n",
                    "Marginal tests for axes\n",
                    howHead(attr(permutations, "control")))
     mod <- paste("Model:", c(object$call))
     attr(out, "heading") <- c(head, mod)
-    class(out) <- c("anova", "data.frame")
+    attr(out, "F.perm") <- F.perm
+    class(out) <- c("anova.cca", "anova", "data.frame")
     out
 }
diff --git a/R/anova.ccalist.R b/R/anova.ccalist.R
index d682fa0..e628cc8 100644
--- a/R/anova.ccalist.R
+++ b/R/anova.ccalist.R
@@ -1,6 +1,7 @@
 `anova.ccalist` <-
     function(object, permutations, model, parallel)
 {
+    EPS <- sqrt(.Machine$double.eps)
     ## 'object' *must* be a list of cca objects, and 'permutations'
     ## *must* be a permutation matrix -- we assume that calling
     ## function takes care of this, and this function is not directly
@@ -26,8 +27,8 @@
     ## 4. Terms must be nested
     trms <- lapply(object, function(z) labels(terms(z)))
     o  <- order(sapply(trms, length))
-    for(i in 2:nmodels) 
-        if(!all(trms[[o[i-1]]] %in% trms[[o[i]]]))
+    for (i in 2:nmodels) 
+        if (!all(trms[[o[i-1]]] %in% trms[[o[i]]]))
             stop("models must be nested")
         
     ## Check permutation matrix
@@ -64,21 +65,24 @@
     pfvals <- apply(pfvals, 1, diff)
     ## dropped to vector?
     if (!is.matrix(pfvals))
-        pfvals <- matrix(pfvals, nrow=1, ncol=nperm)
+        pfvals <- matrix(pfvals, nrow = 1, ncol = nperm)
     pfvals <- sweep(pfvals, 1, df, "/")
     pfvals <- sweep(pfvals, 2, pscale, "/")
-    pval <- rowSums(sweep(pfvals, 1, fval, ">="))
-    pval <- (pval + 1)/(nperm+1)
+    pval <- rowSums(sweep(pfvals, 1, fval - EPS, ">="))
+    pval <- (pval + 1)/(nperm + 1)
     ## collect table
     table <- data.frame(resdf, resdev, c(NA, df),
                         c(NA,changedev), c(NA,fval), c(NA,pval))
-    isRDA <- method != "cca"
+    if (inherits(object, "capscale") &&
+        (object$adjust != 1 || is.null(object$adjust)))
+        varname <- "SumOfSqs"
+    else if (inherits(object, "rda"))
+        varname <- "Variance"
+    else
+        varname <- "ChiSquare"
     dimnames(table) <- list(1L:nmodels,
-                            c("Res.Df",
-                              ifelse(isRDA,"Res.Variance", "Res.ChiSquare"), 
-                              "Df",
-                              ifelse(isRDA,"Variance","ChiSquare"),
-                                     "F", "Pr(>F)"))
+                            c("ResDf", paste0("Res", varname), "Df",
+                              varname, "F", "Pr(>F)"))
     ## Collect header information
     formulae <- sapply(object, function(z) deparse(formula(z)))
     head <- paste0("Permutation tests for ", method, " under ",
@@ -86,5 +90,7 @@
                    howHead(attr(permutations, "control")))
     topnote <- paste("Model ", format(1L:nmodels), ": ", formulae,
                      sep = "", collapse = "\n")
-    structure(table, heading=c(head,topnote), class = c("anova", "data.frame"))
+    structure(table, heading = c(head,topnote), 
+              F.perm = t(pfvals),
+              class = c("anova.cca", "anova", "data.frame"))
 }
diff --git a/R/anova.ccanull.R b/R/anova.ccanull.R
index 5aa8cd5..7ffb84c 100644
--- a/R/anova.ccanull.R
+++ b/R/anova.ccanull.R
@@ -4,19 +4,24 @@
 `anova.ccanull` <-
     function(object, ...)
 {
-    table <- matrix(0, nrow = 2, ncol = 5)
+    table <- matrix(0, nrow = 2, ncol = 4)
     if (object$CA$rank == 0) {
-        table[1,] <- c(object$CCA$qrank, object$CCA$tot.chi, NA, 0, NA)
-        table[2,] <- c(0,0,NA,NA,NA)
+        table[1,] <- c(object$CCA$qrank, object$CCA$tot.chi, NA, NA)
+        table[2,] <- c(0,0,NA,NA)
     }
     else {
-        table[1,] <- c(0,0,0,0,NA)
-        table[2,] <- c(nrow(object$CA$u) - 1, object$CA$tot.chi, NA, NA, NA)
+        table[1,] <- c(0,0,0,NA)
+        table[2,] <- c(nrow(object$CA$u) - 1, object$CA$tot.chi, NA, NA)
     }
     rownames(table) <- c("Model", "Residual")
-    colnames(table) <-  c("Df",
-                          if (inherits(object, "rda")) "Var" else "Chisq", 
-                          "F", "N.Perm", "Pr(>F)")
+    if (inherits(object, "capscale") &&
+        (object$adjust != 1 || is.null(object$adjust)))
+        varname <- "SumOfSqs"
+    else if (inherits(object, "rda"))
+        varname <- "Variance"
+    else
+        varname <- "ChiSquare"
+    colnames(table) <- c("Df", varname, "F", "Pr(>F)")
     table <- as.data.frame(table)
     if (object$CA$rank == 0)
         head <- "No residual component\n"
diff --git a/R/biplot.rda.R b/R/biplot.rda.R
index 4badb1d..7661a08 100644
--- a/R/biplot.rda.R
+++ b/R/biplot.rda.R
@@ -12,9 +12,10 @@
         NextMethod("biplot", x, ...)
 }
 
-`biplot.rda` <- function(x, choices = c(1, 2), scaling = 2,
-                       display = c("sites", "species"),
-                       type, xlim, ylim, col = c(1,2), const, ...) {
+`biplot.rda` <- function(x, choices = c(1, 2), scaling = "species",
+                         display = c("sites", "species"),
+                         type, xlim, ylim, col = c(1,2), const,
+                         correlation = FALSE, ...) {
   if(!inherits(x, "rda"))
       stop("'biplot.rda' is only for objects of class 'rda'")
   if(!is.null(x$CCA))
diff --git a/R/centroids.cca.R b/R/centroids.cca.R
index a267b4f..3bd857a 100644
--- a/R/centroids.cca.R
+++ b/R/centroids.cca.R
@@ -1,7 +1,7 @@
 `centroids.cca` <-
     function(x, mf, wt)
 {
-    facts <- sapply(mf, is.factor)
+    facts <- sapply(mf, is.factor) | sapply(mf, is.character)
     if (!any(facts))
         return(NULL)
     mf <- mf[, facts, drop = FALSE]
diff --git a/R/factorfit.R b/R/factorfit.R
index ebf5a0e..a392157 100644
--- a/R/factorfit.R
+++ b/R/factorfit.R
@@ -1,6 +1,7 @@
 `factorfit` <-
     function (X, P, permutations = 0, strata = NULL, w,  ...)
 {
+    EPS <- sqrt(.Machine$double.eps)
     P <- as.data.frame(P)
     ## Check that all variables are factors, and coerce if necessary
     if(any(!sapply(P, is.factor)))
@@ -50,7 +51,7 @@
             }
             tmp <- sapply(seq_len(permutations),
                           function(indx,...) ptest(permat[indx,], ...))
-            pval.this <- (sum(tmp >= r.this) + 1)/(permutations + 1)
+            pval.this <- (sum(tmp >= r.this - EPS) + 1)/(permutations + 1)
             pval <- c(pval, pval.this)
         }
     }
diff --git a/R/mantel.R b/R/mantel.R
index 37de3e0..7b94776 100644
--- a/R/mantel.R
+++ b/R/mantel.R
@@ -2,6 +2,7 @@
   function (xdis, ydis, method = "pearson", permutations = 999, 
             strata = NULL, na.rm = FALSE, parallel = getOption("mc.cores")) 
 {
+    EPS <- sqrt(.Machine$double.eps)
     xdis <- as.dist(xdis)
     ydis <- as.vector(as.dist(ydis))
     ## Handle missing values
@@ -54,7 +55,7 @@
         } else {
             perm <- sapply(1:permutations, function(i, ...) ptest(permat[i,], ...))
         }
-        signif <- (sum(perm >= statistic) + 1)/(permutations + 1)
+        signif <- (sum(perm >= statistic - EPS) + 1)/(permutations + 1)
     }
     else {
         signif <- NA
diff --git a/R/mantel.partial.R b/R/mantel.partial.R
index 04d9617..bfc5e0e 100644
--- a/R/mantel.partial.R
+++ b/R/mantel.partial.R
@@ -2,6 +2,7 @@
   function (xdis, ydis, zdis, method = "pearson", permutations = 999, 
             strata = NULL, na.rm = FALSE, parallel = getOption("mc.cores")) 
 {
+    EPS <- sqrt(.Machine$double.eps)
     part.cor <- function(rxy, rxz, ryz) {
         (rxy - rxz * ryz)/sqrt(1-rxz*rxz)/sqrt(1-ryz*ryz)
     }
@@ -62,7 +63,7 @@
         } else {
             perm <- sapply(1:permutations, function(i, ...) ptest(permat[i,], ...))
         }
-        signif <- (sum(perm >= statistic)+1)/(permutations + 1)
+        signif <- (sum(perm >= statistic - EPS)+1)/(permutations + 1)
     }
     else {
         signif <- NA
diff --git a/R/metaMDS.R b/R/metaMDS.R
index fafa804..db82a81 100644
--- a/R/metaMDS.R
+++ b/R/metaMDS.R
@@ -6,11 +6,17 @@
               plot = FALSE, previous.best,  ...) 
 {
     engine <- match.arg(engine)
-    commname <- deparse(substitute(comm))
+    ## This could be a character vector of length > 1L
+    commname <- deparse(substitute(comm), width.cutoff = 500L)
+    if (length(commname) > 1L) {
+        paste(commname, collapse = "", sep = "")
+        ## deparse can add more white space, so cull 2 or more spaces to a single space
+        commname <- gsub("[ ]{2,}", " ", commname)
+    }
     ## metaMDS was written for community data which should be all
     ## positive. Check this here, and set arguments so that they are
     ## suitable for non-negative data.
-    if (any(autotransform, noshare > 0, wascores) && any(comm < 0)) {
+    if (any(autotransform, noshare > 0, wascores) && any(comm < 0, na.rm=TRUE)) {
         warning("'comm' has negative data: 'autotransform', 'noshare' and 'wascores' set to FALSE")
         wascores <- FALSE
         autotransform <- FALSE
@@ -45,13 +51,14 @@
     points <- postMDS(out$points, dis, plot = max(0, plot - 1), ...)
     if (is.null(rownames(points))) 
         rownames(points) <- rownames(comm)
-    if (wascores) {
+    wa <- if (wascores) {
         ## transformed data
-        comm <- eval.parent(parse(text=attr(dis, "commname")))
-        wa <- wascores(points, comm, expand = expand)
+        ##comm <- eval.parent(parse(text=attr(dis, "commname")))
+        comm <- attr(dis, "comm")
+        wascores(points, comm, expand = expand)
+    } else {
+        NA
     }
-    else
-        wa <- NA
     out$points <- points
     out$species <- wa
     out$call <- match.call()
diff --git a/R/metaMDSdist.R b/R/metaMDSdist.R
index d9e96ac..8b91648 100644
--- a/R/metaMDSdist.R
+++ b/R/metaMDSdist.R
@@ -64,6 +64,7 @@
     }
     attr(dis, "maxdis") <- maxdis
     attr(dis, "commname") <- commname
+    attr(dis, "comm") <- comm
     attr(dis, "function") <- distname
     dis
 }
diff --git a/R/monoMDS.R b/R/monoMDS.R
index df1064c..a3a5fd5 100644
--- a/R/monoMDS.R
+++ b/R/monoMDS.R
@@ -10,7 +10,7 @@
           && ncol(dist) == nrow(dist)
           && isTRUE(all.equal(dist[lower.tri(dist)], t(dist)[lower.tri(dist)]))))
         stop("'dist' must be a distance object (class \"dist\") or a symmetric square matrix")
-    if (any(dist < -sqrt(.Machine$double.eps)))
+    if (any(dist < -sqrt(.Machine$double.eps), na.rm = TRUE))
         warning("some dissimilarities are negative -- is this intentional?")
     ## match.arg
     model <- match.arg(model)
diff --git a/R/mrpp.R b/R/mrpp.R
index 1b420ea..cf28454 100644
--- a/R/mrpp.R
+++ b/R/mrpp.R
@@ -3,6 +3,7 @@
               weight.type = 1, strata = NULL,
               parallel = getOption("mc.cores")) 
 {
+    EPS <- sqrt(.Machine$double.eps)
     classmean <- function(ind, dmat, indls) {
         sapply(indls, function(x)
                mean(c(dmat[ind == x, ind == x]),
@@ -69,7 +70,7 @@
         } else {
             m.ds <- apply(perms, 2, function(x) mrpp.perms(x, dmat, indls, w))
         }
-        p <- (1 + sum(del >= m.ds))/(permutations + 1)
+        p <- (1 + sum(del + EPS >= m.ds))/(permutations + 1)
         r2 <- 1 - del/E.del
     } else { # no permutations
         m.ds <- p <- r2 <- NA
diff --git a/R/mso.R b/R/mso.R
index ba1ec7b..9654af6 100644
--- a/R/mso.R
+++ b/R/mso.R
@@ -2,6 +2,7 @@
     function (object.cca, object.xy, grain = 1, round.up = FALSE,
               permutations = 0) 
 {
+    EPS <- sqrt(.Machine$double.eps)
     if (inherits(object.cca, "mso")) {
         rm <- which(class(object.cca) == "mso")
         class(object.cca) <- class(object.cca)[-rm]
@@ -76,7 +77,8 @@
         }
         perm <- sapply(1:nperm, function(take) permfunc(permat[take,]))
         object$vario$CA.signif <-
-            (rowSums(sweep(perm, 1, statistic, ">=")) + 1)/(nperm + 1)
+            (rowSums(sweep(perm, 1, statistic - EPS, ">=")) + 1)/
+                (nperm + 1)
         attr(object$vario, "control") <- attr(permat, "control")
     }
     object$call <- match.call()
diff --git a/R/oecosimu.R b/R/oecosimu.R
index 5c26ea8..4bcc0d8 100644
--- a/R/oecosimu.R
+++ b/R/oecosimu.R
@@ -143,8 +143,15 @@
     z <- (indstat - means)/sd
     if (any(sd < sqrt(.Machine$double.eps)))
         z[sd < sqrt(.Machine$double.eps)] <- 0
-    pless <- rowSums(indstat >= simind, na.rm = TRUE)
-    pmore <- rowSums(indstat <= simind, na.rm = TRUE)
+    ## results can be integers or real: comparisons differ
+    if (is.integer(indstat) && is.integer(simind)) {
+        pless <- rowSums(indstat >= simind, na.rm = TRUE)
+        pmore <- rowSums(indstat <= simind, na.rm = TRUE)
+    } else {
+        EPS <- sqrt(.Machine$double.eps)
+        pless <- rowSums(indstat + EPS >= simind, na.rm = TRUE)
+        pmore <- rowSums(indstat - EPS <= simind, na.rm = TRUE)
+    }
     if (any(is.na(simind))) {
         warning("some simulated values were NA and were removed")
         nsimul <- nsimul - rowSums(is.na(simind))
diff --git a/R/ordiR2step.R b/R/ordiR2step.R
index 6ec05e0..a737bbe 100644
--- a/R/ordiR2step.R
+++ b/R/ordiR2step.R
@@ -21,6 +21,11 @@
         R2.0 <- 0
     else
         R2.0 <- RsquareAdj(object)$adj.r.squared
+    ## only accepts upper scope
+    if (is.list(scope) && length(scope) <= 2L)
+        scope <- scope$upper
+    if (is.null(scope) || !length(add.scope(object, scope)))
+        stop("needs upper 'scope': no terms can be added")
     ## Get R2 of the scope
     if (inherits(scope, "rda")) 
         scope <- delete.response(formula(scope))
diff --git a/R/ordiareatest.R b/R/ordiareatest.R
index 36919e0..b5b7a1d 100644
--- a/R/ordiareatest.R
+++ b/R/ordiareatest.R
@@ -16,6 +16,7 @@
     function(ord, groups, area = c("hull", "ellipse"), permutations = 999,
              parallel = getOption("mc.cores"), ...)
 {
+    EPS <- sqrt(.Machine$double.eps)
     ## Function to find area
     area <- match.arg(area)
     areafun <- if (area == "hull") ordihull else ordiellipse
@@ -47,7 +48,7 @@
     } else {
         areas <- sapply(1:permutations, function(i, ...) pfun(perm[i,], ...))
     }
-    signif <- (rowSums(areas <= obs) + 1)/(nperm + 1)
+    signif <- (rowSums(areas <= obs + EPS) + 1)/(nperm + 1)
     out <- list("areas" = obs, "pvalues" = signif, "permutations" = areas,
                 nperm = nperm, control = attr(perm, "control"), "kind" = area)
     class(out) <- "ordiareatest"
diff --git a/R/permustats.R b/R/permustats.R
index cf523aa..c4e6246 100644
--- a/R/permustats.R
+++ b/R/permustats.R
@@ -147,10 +147,10 @@
     function(x, ...)
 {
     structure(list(
-        "statistic" = structure(x$statistic, names="R"),
+        "statistic" = structure(x$statistic, names = "R"),
         "permutations" = x$perm,
         "alternative" = "greater"),
-              class="permustats")
+              class = "permustats")
 }
 
 `permustats.adonis` <-
@@ -162,27 +162,27 @@
         "statistic" = structure(tab$F.Model[k], names = rownames(tab)[k]),
         "permutations" = x$f.perms,
         "alternative" = "greater"),
-              class="permustats")
+              class = "permustats")
 }
 
 `permustats.mantel` <-
     function(x, ...)
 {
     structure(list(
-        "statistic" = structure(x$statistic, names="r"),
+        "statistic" = structure(x$statistic, names = "r"),
         "permutations" = x$perm,
         "alternative" = "greater"),
-              class="permustats")
+              class = "permustats")
 }
 
 `permustats.mrpp` <-
     function(x, ...)
 {
     structure(list(
-        "statistic" = structure(x$delta, names="delta"),
+        "statistic" = structure(x$delta, names = "delta"),
         "permutations" = x$boot.deltas,
         "alternative" = "less"),
-              class="permustats")
+              class = "permustats")
 }
 
 `permustats.oecosimu` <-
@@ -192,7 +192,7 @@
         "statistic" = x$oecosimu$statistic,
         "permutations" = t(x$oecosimu$simulated),
         "alternative" = x$oecosimu$alternative),
-              class="permustats")
+              class = "permustats")
 }
 
 `permustats.ordiareatest` <-
@@ -212,7 +212,7 @@
         "statistic" = structure(x$F.0, names = "F"),
         "permutations" = x$F.perm,
         "alternative" = "greater"),
-              class="permustats")
+              class = "permustats")
 }
 
 `permustats.protest` <-
@@ -222,7 +222,7 @@
         "statistic" = structure(x$t0, names = "r"),
         "permutations" = x$t,
         "alternative" = "greater"),
-              class="permustats")
+              class = "permustats")
 }
 
 ### the following do not return permutation data
@@ -268,5 +268,20 @@
     structure(list("statistic" = x$statistic,
                    "permutations" = x$perm,
                    "alternative" = alt),
-              class ="permustats")
+              class = "permustats")
 }
+
+`permustats.anova.cca` <-
+    function(x, ...)
+{
+    if (is.null(attr(x, "F.perm")))
+        stop("no permutation data available")
+    F.perm <- attr(x, "F.perm")
+    k <- !is.na(x$F)
+    F.0 <- x$F[k]
+    structure(list(
+       "statistic" = structure(F.0, names = rownames(x)[k]),
+       "permutations" = F.perm,
+       "alternative" = "greater"),
+       class = "permustats")
+}
\ No newline at end of file
diff --git a/R/permutest.betadisper.R b/R/permutest.betadisper.R
index 9e01a2e..55450a0 100644
--- a/R/permutest.betadisper.R
+++ b/R/permutest.betadisper.R
@@ -2,6 +2,7 @@
                                    permutations = 999,
                                    parallel = getOption("mc.cores"), ...)
 {
+    EPS <- sqrt(.Machine$double.eps) # for P-value comparisons
     t.statistic <- function(x, y) {
         m <- length(x)
         n <- length(y)
@@ -104,8 +105,8 @@
 
     ## Process results
     F0 <- summary(mod)$fstatistic[1]
-    Fstats <- round(Pstats[, 1], 12)    # allow empty dim to be dropped
-    statistic <- F0 <- round(F0, 12)
+    Fstats <- Pstats[, 1]    # allow empty dim to be dropped
+    statistic <- F0
     names(statistic) <- "Overall (F)"
 
     ## pairwise comparisons
@@ -113,13 +114,12 @@
         T0 <- apply(combn(levels(group), 2), 2, function(z) {
             t.statistic(x$distances[group == z[1]],
                         x$distances[group == z[2]])})
-        Tstats <- round(Pstats[, -1, drop = FALSE], 12)
-        T0 <- round(T0, 12)
+        Tstats <- Pstats[, -1, drop = FALSE]
         statistic <- c(statistic, T0)
     }
 
     ## compute permutation p-value
-    pval <- (sum(Fstats >= F0) + 1) / (length(Fstats) + 1)
+    pval <- (sum(Fstats >= F0 - EPS) + 1) / (length(Fstats) + 1)
 
     if(pairwise) {
         df <- apply(combin, 2, function(z) {
diff --git a/R/permutest.cca.R b/R/permutest.cca.R
index dce3405..06655fb 100644
--- a/R/permutest.cca.R
+++ b/R/permutest.cca.R
@@ -139,10 +139,6 @@ permutest.default <- function(x, ...)
     num <- tmp[,1]
     den <- tmp[,2]
     F.perm <- tmp[,3]
-    ## Round to avoid arbitrary ordering of statistics due to
-    ## numerical inaccuracy
-    F.0 <- round(F.0, 12)
-    F.perm <- round(F.perm, 12)
     Call <- match.call()
     Call[[1]] <- as.name("permutest")
     sol <- list(call = Call, testcall = x$call, model = model,
diff --git a/R/plot.cca.R b/R/plot.cca.R
index 071e9b1..c8bd205 100644
--- a/R/plot.cca.R
+++ b/R/plot.cca.R
@@ -1,9 +1,9 @@
-`plot.cca` <-
-    function (x, choices = c(1, 2), display = c("sp", "wa", "cn"),
-              scaling = 2, type, xlim, ylim,  const, ...)
-{
+`plot.cca` <- function (x, choices = c(1, 2), display = c("sp", "wa", "cn"),
+                        scaling = "species", type, xlim, ylim, const,
+                        correlation = FALSE, hill = FALSE, ...) {
     TYPES <- c("text", "points", "none")
-    g <- scores(x, choices, display, scaling, const)
+    g <- scores(x, choices, display, scaling, const, correlation = correlation,
+                hill = hill)
     if (length(g) == 0 || all(is.na(g)))
       stop("nothing to plot: requested scores do not exist")
     if (!is.list(g))
diff --git a/R/plot.prc.R b/R/plot.prc.R
index a557374..078fe71 100644
--- a/R/plot.prc.R
+++ b/R/plot.prc.R
@@ -1,11 +1,12 @@
 `plot.prc` <-
-    function (x, species = TRUE, select, scaling = 3, axis = 1, type = "l",
-              xlab, ylab, ylim, lty = 1:5, col = 1:6, pch, legpos, cex = 0.8,
-              ...)
+    function (x, species = TRUE, select, scaling = "symmetric", axis = 1,
+              correlation = FALSE, type = "l", xlab, ylab, ylim, lty = 1:5,
+              col = 1:6, pch, legpos, cex = 0.8, ...)
 {
     ## save level names before getting the summary
     levs <- x$terminfo$xlev[[2]]
-    x <- summary(x, scaling = scaling, axis = axis)
+    x <- summary(x, scaling = scaling, axis = axis,
+                 correlation = correlation)
     oldpar <- par(no.readonly = TRUE)
     on.exit(par(oldpar))
     b <- t(coef(x))
diff --git a/R/points.cca.R b/R/points.cca.R
index 245a084..0e616f0 100644
--- a/R/points.cca.R
+++ b/R/points.cca.R
@@ -1,19 +1,20 @@
 `points.cca` <-
-    function (x, display = "sites", choices = c(1, 2), scaling = 2,
-              arrow.mul, head.arrow = 0.05, select, const, axis.bp = TRUE, ...)
+    function (x, display = "sites", choices = c(1, 2), scaling = "species",
+              arrow.mul, head.arrow = 0.05, select, const, axis.bp = TRUE,
+              correlation = FALSE, hill = FALSE, ...)
 {
     formals(arrows) <- c(formals(arrows), alist(... = ))
     if (length(display) > 1)
         stop("only one 'display' item can be added in one command")
     pts <- scores(x, choices = choices, display = display, scaling = scaling,
-                  const)
+                  const, correlation = correlation, hill = hill)
     if (!missing(select))
         pts <- .checkSelect(select, pts)
     if (display == "cn") {
         cnam <- rownames(pts)
         points(pts, ...)
         pts <- scores(x, choices = choices, display = "bp", scaling = scaling,
-                      const)
+                      const, correlation = correlation, hill = hill)
         bnam <- rownames(pts)
         pts <- pts[!(bnam %in% cnam), , drop = FALSE]
         if (nrow(pts) == 0)
diff --git a/R/predict.cca.R b/R/predict.cca.R
index 5d940fe..41df366 100644
--- a/R/predict.cca.R
+++ b/R/predict.cca.R
@@ -1,6 +1,7 @@
 `predict.cca` <-
     function (object, newdata, type = c("response", "wa", "sp", "lc", "working"), 
-              rank = "full", model = c("CCA", "CA"), scaling = FALSE, ...) 
+              rank = "full", model = c("CCA", "CA"), scaling = "none",
+              hill = FALSE, ...) 
 {
     type <- match.arg(type)
     model <- match.arg(model)
@@ -20,6 +21,8 @@
     if (is.null(w)) 
         w <- u
     slam <- diag(sqrt(object[[model]]$eig[1:take]), nrow = take)
+    ## process scaling arg, scaling used later so needs to be a numeric
+    scaling <- scalingType(scaling = scaling, hill = hill)
     if (type %in%  c("response", "working")) {
         Xbar <- 0
         if (!missing(newdata)) {
@@ -56,7 +59,7 @@
             u <- u[, 1:take, drop = FALSE]
         }
         out <- u
-        if (scaling) {
+        if (scaling) {      # implicit conversion "none" == 0 == FALSE
             scal <- list(diag(slam), 1, sqrt(diag(slam)))[[abs(scaling)]]
             out <- sweep(out, 2, scal, "*")
             if (scaling < 0) {
@@ -87,7 +90,7 @@
             w <- sweep(w, 2, diag(slam), "/")
         }
         out <- w
-        if (scaling) {
+        if (scaling) {      # implicit conversion "none" == 0 == FALSE
             scal <- list(diag(slam), 1, sqrt(diag(slam)))[[abs(scaling)]]
             out <- sweep(out, 2, scal, "*")
             if (scaling < 0) {
@@ -114,7 +117,7 @@
             v <- sweep(v, 2, diag(slam), "/")
         }
         out <- v
-        if (scaling) {
+        if (scaling) {      # implicit conversion "none" == 0 == FALSE
             scal <- list(1, diag(slam), sqrt(diag(slam)))[[abs(scaling)]]
             out <- sweep(out, 2, scal, "*")
             if (scaling < 0) {
diff --git a/R/predict.rda.R b/R/predict.rda.R
index a2e7dce..cb43f71 100644
--- a/R/predict.rda.R
+++ b/R/predict.rda.R
@@ -1,6 +1,7 @@
 `predict.rda` <-
     function (object, newdata, type = c("response", "wa", "sp", "lc", "working"), 
-              rank = "full", model = c("CCA", "CA"), scaling = FALSE, ...) 
+              rank = "full", model = c("CCA", "CA"), scaling = "none",
+              correlation = FALSE, ...) 
 {
     type <- match.arg(type)
     model <- match.arg(model)
@@ -24,6 +25,8 @@
     if (is.null(w)) 
         w <- u
     slam <- diag(sqrt(object[[model]]$eig[1:take] * nr), nrow = take)
+    ## process scaling arg, scaling used later so needs to be a numeric
+    scaling <- scalingType(scaling = scaling, correlation = correlation)
     if (type %in% c("response", "working")) {
         if (!missing(newdata)) {
             u <- predict(object, type = if(model == "CCA") "lc" else "wa",
@@ -75,7 +78,7 @@
             u <- u[, 1:take, drop = FALSE]
         }
         out <- u
-        if (scaling) {
+        if (scaling) {   # implicit coercion 0 == FALSE, other == TRUE
             tot <- sqrt(object$tot.chi * nr)
             lam <- list(diag(slam)/tot, 1, sqrt(diag(slam)/tot))[[abs(scaling)]]
             out <- sqrt(tot) * sweep(out, 2, lam, "*")
@@ -103,7 +106,7 @@
             w <- sweep(w, 2, diag(slam), "/")
         }
         out <- w
-        if (scaling) {
+        if (scaling) {   # implicit coercion 0 == FALSE, other == TRUE
             tot <- sqrt(object$tot.chi * nr)
             lam <- list(diag(slam)/tot, 1, sqrt(diag(slam)/tot))[[abs(scaling)]]
             out <- sqrt(tot) * sweep(out, 2, lam, "*")
@@ -127,7 +130,7 @@
             v <- sweep(v, 2, diag(slam), "/")
         }
         out <- v
-        if (scaling) {
+        if (scaling) {   # implicit coercion 0 == FALSE, other == TRUE
             tot <- sqrt(object$tot.chi * nr)
             scal <- list(1, diag(slam)/tot, sqrt(diag(slam)/tot))[[abs(scaling)]]
             out <- sqrt(tot) * sweep(out, 2, scal, "*")
diff --git a/R/print.cca.R b/R/print.cca.R
index 1dd943c..d6cf8b7 100644
--- a/R/print.cca.R
+++ b/R/print.cca.R
@@ -27,7 +27,7 @@
     ## Remove "Proportion" if only one component
     if (is.null(x$CCA) && is.null(x$pCCA))
         tbl <- tbl[,-2]
-    printCoefmat(tbl, digits = digits, na.print = "", zap.ind = 1:2)
+    printCoefmat(tbl, digits = digits, na.print = "")
     cat("Inertia is", x$inertia, "\n")
     if (!is.null(x$CCA$alias))
         cat("Some constraints were aliased because they were collinear (redundant)\n")
diff --git a/R/print.permutest.cca.R b/R/print.permutest.cca.R
index 8f48257..370793e 100644
--- a/R/print.permutest.cca.R
+++ b/R/print.permutest.cca.R
@@ -1,10 +1,11 @@
 `print.permutest.cca` <-
     function (x, ...) 
 {
+    EPS <- sqrt(.Machine$double.eps)
     cat("\nPermutation test for", x$method, "\n\n")
     cat(howHead(x$control), "\n")
     writeLines(strwrap(pasteCall(x$testcall)))
-    Pval <- (sum(x$F.perm >= x$F.0) + 1)/(x$nperm + 1)
+    Pval <- (sum(x$F.perm >= x$F.0 - EPS) + 1)/(x$nperm + 1)
     cat("Permutation test for ")
     if (x$first)
         cat("first constrained eigenvalue\n")
diff --git a/R/protest.R b/R/protest.R
index 1097d93..4112886 100644
--- a/R/protest.R
+++ b/R/protest.R
@@ -2,6 +2,7 @@
     function (X, Y, scores = "sites", permutations = how(nperm = 999),
               ...)
 {
+    EPS <- sqrt(.Machine$double.eps)
     X <- scores(X, display = scores, ...)
     Y <- scores(Y, display = scores, ...)
     ## Centre and normalize X & Y here so that the permutations will
@@ -34,7 +35,7 @@
     perm <- sapply(seq_len(np),
                    function(i, ...) procr(X, Y[permutations[i,],]))
 
-    Pval <- (sum(perm >= sol$t0) + 1)/(np + 1)
+    Pval <- (sum(perm >= sol$t0 - EPS) + 1)/(np + 1)
 
     sol$t <- perm
     sol$signif <- Pval
diff --git a/R/rarecurve.R b/R/rarecurve.R
index 970a955..de63cb1 100644
--- a/R/rarecurve.R
+++ b/R/rarecurve.R
@@ -2,6 +2,9 @@
     function(x, step = 1, sample, xlab = "Sample Size", ylab = "Species",
              label = TRUE, col, lty, ...)
 {
+    ## check input data: must be counts
+    if (!identical(all.equal(x, round(x)), TRUE))
+        stop("function accepts only integers (counts)")
     ## sort out col and lty
     if (missing(col))
         col <- par("col")
@@ -9,6 +12,13 @@
         lty <- par("lty")
     tot <- rowSums(x)
     S <- specnumber(x)
+    ## remove empty rows or we fail
+    if (any(S <= 0)) {
+        message("empty rows removed")
+        x <- x[S > 0,, drop =FALSE]
+        tot <- tot[S > 0]
+        S <- S[S > 0]
+    }
     nr <- nrow(x)
     ## rep col and lty to appropriate length
     col <- rep(col, length.out = nr)
diff --git a/R/scalingUtils.R b/R/scalingUtils.R
new file mode 100644
index 0000000..72035fe
--- /dev/null
+++ b/R/scalingUtils.R
@@ -0,0 +1,27 @@
+##' @title Utility for handling user friendly scaling --- None exported
+##'
+##' @description Convert user-friendly descriptions of scalings to numeric codes used by \code{scores} to date.
+##'
+##' @param scaling character or numeric; which type of scaling is required? Numeric values are returned unaltered
+##' @param correlation logical; should correlation-like scores be returned?
+##' @param hill logical; should Hill's scaling scores be returned?
+`scalingType` <- function(scaling = c("none", "sites", "species", "symmetric"),
+                          correlation = FALSE, hill = FALSE) {
+    ## Only process scaling further if it is character
+    if (is.numeric(scaling)) {
+        return(scaling)                 # numeric; return early
+    } else if (is.character(scaling)) {
+        ## non-numeric scaling: change to correct numeric code
+        scaling <- match.arg(scaling)   # match user choice
+        ## Keep `tab` as this is the order of numeric codes
+        ## Allows potential to change the default ordering of formal argument 'scaling'
+        tab <- c("none", "sites", "species", "symmetric")
+        scaling <- match(scaling, tab) - 1      # -1 as none == scaling 0
+        if (correlation || hill) {
+            scaling <- -scaling
+        }
+    } else {
+        stop("'scaling' is not 'numeric' nor 'character'.")
+    }
+    scaling                             # return
+}
diff --git a/R/scores.cca.R b/R/scores.cca.R
index 2c76ef1..f90d997 100644
--- a/R/scores.cca.R
+++ b/R/scores.cca.R
@@ -1,6 +1,6 @@
 `scores.cca` <-
-    function (x, choices = c(1, 2), display = c("sp", "wa", "cn"), 
-              scaling = 2, ...) 
+    function (x, choices = c(1, 2), display = c("sp", "wa", "cn"),
+              scaling = "species", hill = FALSE, ...)
 {
     if(inherits(x, "pcaiv")) {
         warning("looks like ade4::cca object: you better use ade4 functions")
@@ -10,10 +10,10 @@
     ## "exclude"
     if (!is.null(x$na.action) && inherits(x$na.action, "exclude"))
         x <- ordiNApredict(x$na.action, x)
-    tabula <- c("species", "sites", "constraints", "biplot", 
+    tabula <- c("species", "sites", "constraints", "biplot",
                 "centroids")
     names(tabula) <- c("sp", "wa", "lc", "bp", "cn")
-    if (is.null(x$CCA)) 
+    if (is.null(x$CCA))
         tabula <- tabula[1:2]
     display <- match.arg(display, c("sites", "species", "wa",
                                     "lc", "bp", "cn"),
@@ -26,6 +26,8 @@
     slam <- sqrt(c(x$CCA$eig, x$CA$eig)[choices])
     rnk <- x$CCA$rank
     sol <- list()
+    ## process scaling; numeric scaling will just be returned as is
+    scaling <- scalingType(scaling = scaling, hill = hill)
     if ("species" %in% take) {
         v <- cbind(x$CCA$v, x$CA$v)[, choices, drop = FALSE]
         if (scaling) {
@@ -64,18 +66,18 @@
     }
     if ("biplot" %in% take && !is.null(x$CCA$biplot)) {
         b <- matrix(0, nrow(x$CCA$biplot), length(choices))
-        b[, choices <= rnk] <- x$CCA$biplot[, choices[choices <= 
+        b[, choices <= rnk] <- x$CCA$biplot[, choices[choices <=
             rnk]]
         colnames(b) <- c(colnames(x$CCA$u), colnames(x$CA$u))[choices]
         rownames(b) <- rownames(x$CCA$biplot)
         sol$biplot <- b
     }
     if ("centroids" %in% take) {
-        if (is.null(x$CCA$centroids)) 
+        if (is.null(x$CCA$centroids))
             sol$centroids <- NA
         else {
             cn <- matrix(0, nrow(x$CCA$centroids), length(choices))
-            cn[, choices <= rnk] <- x$CCA$centroids[, choices[choices <= 
+            cn[, choices <= rnk] <- x$CCA$centroids[, choices[choices <=
                  rnk]]
             colnames(cn) <- c(colnames(x$CCA$u), colnames(x$CA$u))[choices]
             rownames(cn) <- rownames(x$CCA$centroids)
@@ -93,14 +95,14 @@
     ## Take care that scores have names
     if (length(sol)) {
         for (i in seq_along(sol)) {
-            if (is.matrix(sol[[i]])) 
+            if (is.matrix(sol[[i]]))
                 rownames(sol[[i]]) <-
-                    rownames(sol[[i]], do.NULL = FALSE, 
+                    rownames(sol[[i]], do.NULL = FALSE,
                              prefix = substr(names(sol)[i], 1, 3))
         }
     }
     ## Only one type of scores: return a matrix instead of a list
-    if (length(sol) == 1) 
+    if (length(sol) == 1)
         sol <- sol[[1]]
     sol
 }
diff --git a/R/scores.rda.R b/R/scores.rda.R
index 9cc38c6..05aa97e 100644
--- a/R/scores.rda.R
+++ b/R/scores.rda.R
@@ -1,6 +1,6 @@
 `scores.rda` <-
-    function (x, choices = c(1, 2), display = c("sp", "wa", "cn"), 
-              scaling = 2, const, ...) 
+    function (x, choices = c(1, 2), display = c("sp", "wa", "cn"),
+              scaling = "species", const, correlation = FALSE, ...)
 {
     ## Check the na.action, and pad the result with NA or WA if class
     ## "exclude"
@@ -39,6 +39,8 @@
     }
     rnk <- x$CCA$rank
     sol <- list()
+    ## process scaling; numeric scaling will just be returned as is
+    scaling <- scalingType(scaling = scaling, correlation = correlation)
     if ("species" %in% take) {
         v <- cbind(x$CCA$v, x$CA$v)[, choices, drop=FALSE]
         if (scaling) {
diff --git a/R/simper.R b/R/simper.R
index d86b86c..6c14e11 100644
--- a/R/simper.R
+++ b/R/simper.R
@@ -2,6 +2,7 @@
     function(comm, group, permutations = 0, trace = FALSE,
              parallel = getOption("mc.cores"), ...)
 {
+    EPS <- sqrt(.Machine$double.eps)
     if (any(rowSums(comm, na.rm = TRUE) == 0))
         warning("you have empty rows: results may be meaningless")
     pfun <- function(x, comm, comp, i, contrp) {
@@ -78,7 +79,7 @@
                 perm.contr <- sapply(1:nperm, function(d)
                     pfun(d, comm, comp, i, contrp))
             }
-            p <- (rowSums(apply(perm.contr, 2, function(x) x >= average)) + 1) / (nperm + 1)
+            p <- (rowSums(apply(perm.contr, 2, function(x) x >= average - EPS)) + 1) / (nperm + 1)
         }
         else {
           p <- NULL
diff --git a/R/summary.cca.R b/R/summary.cca.R
index 0fbfbf0..7f5f274 100644
--- a/R/summary.cca.R
+++ b/R/summary.cca.R
@@ -1,7 +1,7 @@
-`summary.cca` <-
-    function (object, scaling = 2, axes = 6, display=c("sp","wa","lc","bp","cn"), 
-              digits = max(3, getOption("digits") - 3), ...) 
-{
+`summary.cca` <- function (object, scaling = "species", axes = 6,
+                           display=c("sp","wa","lc","bp","cn"),
+                           digits = max(3, getOption("digits") - 3),
+                           correlation = FALSE, hill = FALSE, ...) {
     if (inherits(object, "pcaiv")) {
         warning("this is an ade4 object which vegan cannot handle")
         axes <- min(axes, object$nf)
@@ -9,8 +9,12 @@
     }
     axes <- min(axes, sum(object$CCA$rank, object$CA$rank))
     summ <- list()
+    ## scaling is stored in return object so must be in numeric format
+    scaling <- scalingType(scaling = scaling, correlation = correlation,
+                           hill = hill)
     if (axes && length(display) && (!is.na(display) && !is.null(display))) 
-        summ <- scores(object, scaling = scaling, choices = 1:axes, display = display, ...)
+        summ <- scores(object, scaling = scaling, choices = 1:axes, display = display,
+                       ...)
     ## scores() drops list to a matrix if there is only one item: workaround below.
     if (!is.list(summ) && length(display) == 1) {
         nms <- c("species", "sites", "constraints", "biplot", "centroids")
diff --git a/R/summary.prc.R b/R/summary.prc.R
index 26b8dfb..d2af016 100644
--- a/R/summary.prc.R
+++ b/R/summary.prc.R
@@ -1,8 +1,7 @@
-`summary.prc` <-
-    function (object, axis = 1, scaling = 3, digits = 4, ...)
-{
+`summary.prc` <- function (object, axis = 1, scaling = "symmetric",
+                           digits = 4, correlation = FALSE, ...) {
     sc = scores(object, scaling = scaling, display = c("sp", "lc"),
-                           choices=axis, ...)
+                choices = axis, correlation = correlation, ...)
     ## coef for scaled sites (coef(object) gives for orthonormal)
     b <- qr.coef(object$CCA$QR, sc$constraints)
     prnk <- object$pCCA$rank
diff --git a/R/text.cca.R b/R/text.cca.R
index dc22d22..62477dc 100644
--- a/R/text.cca.R
+++ b/R/text.cca.R
@@ -1,12 +1,13 @@
 `text.cca` <-
-    function (x, display = "sites", labels, choices = c(1, 2), scaling = 2,
-              arrow.mul, head.arrow = 0.05, select, const, axis.bp = TRUE, ...)
+    function (x, display = "sites", labels, choices = c(1, 2), scaling = "species",
+              arrow.mul, head.arrow = 0.05, select, const, axis.bp = TRUE,
+              correlation = FALSE, hill = FALSE, ...)
 {
     formals(arrows) <- c(formals(arrows), alist(... = ))
     if (length(display) > 1)
         stop("only one 'display' item can be added in one command")
     pts <- scores(x, choices = choices, display = display, scaling = scaling,
-                  const)
+                  const, correlation = correlation, hill = hill)
     ## store rownames of pts for use later, otherwise if user supplies
     ## labels, the checks in "cn" branch fail and "bp" branch will
     ## be entered even if there should be no "bp" plotting
@@ -18,7 +19,7 @@
     if (display == "cn") {
         text(pts, labels = rownames(pts), ...)
         pts <- scores(x, choices = choices, display = "bp", scaling = scaling,
-                      const)
+                      const, correlation = correlation, hill = hill)
         bnam <- rownames(pts)
         pts <- pts[!(bnam %in% cnam), , drop = FALSE]
         if (nrow(pts) == 0)
diff --git a/R/tolerance.cca.R b/R/tolerance.cca.R
index 3bc2883..fdccbce 100644
--- a/R/tolerance.cca.R
+++ b/R/tolerance.cca.R
@@ -10,7 +10,7 @@
 ##' @param which character; one of \code{"species"} or \code{"sites"},
 ##' indicating whether species tolerances or sample heterogeneities
 ##' respectively are computed.
-##' @param scaling numeric; the ordination scaling to use.
+##' @param scaling numeric or character; the ordination scaling to use.
 ##' @param useN2 logical; should the bias in the tolerances /
 ##' heterogeneities be reduced via scaling by Hill's N2?
 ##' @param ... arguments passed to other methods
@@ -25,7 +25,8 @@
 ##'
 tolerance.cca <- function(x, choices = 1:2,
                           which = c("species","sites"),
-                          scaling = 2, useN2 = FALSE, ...) {
+                          scaling = "species", useN2 = FALSE,
+                          hill = FALSE, ...) {
     if(inherits(x, "rda"))
         stop("tolerances only available for unimodal ordinations")
     if(missing(which))
@@ -40,8 +41,10 @@ tolerance.cca <- function(x, choices = 1:2,
           x$rowsum %o% x$colsum) * x$grand.total
     which <- match.arg(which)
     siteScrTypes <- if(is.null(x$CCA)){ "sites" } else {"lc"}
+    ## Sort out scaling; only for (C)CA so no correlation arg
+    scaling <- scalingType(scaling, hill = hill)
     scrs <- scores(x, display = c(siteScrTypes,"species"),
-                   choices = choices, scaling = scaling)
+                   choices = choices, scaling = scaling, ...)
     ## compute N2 if useN2 == TRUE & only if
     doN2 <- isTRUE(useN2) && ((which == "species" && abs(scaling) == 2) ||
                               (which == "sites" && abs(scaling) == 1))
diff --git a/R/vectorfit.R b/R/vectorfit.R
index e328220..f44ca5a 100644
--- a/R/vectorfit.R
+++ b/R/vectorfit.R
@@ -1,6 +1,7 @@
 "vectorfit" <-
     function (X, P, permutations = 0, strata = NULL, w, ...) 
 {
+    EPS <- sqrt(.Machine$double.eps)
     if (missing(w) || is.null(w)) 
         w <- 1
     if (length(w) == 1) 
@@ -47,7 +48,7 @@
         ## permutations are the matrix columns and variables are rows
         if (!is.matrix(permstore))
             permstore <- matrix(permstore, ncol=permutations)
-        permstore <- sweep(permstore, 1, r, ">=")
+        permstore <- sweep(permstore, 1, r - EPS, ">=")
         validn <- rowSums(is.finite(permstore))
         pvals <- (rowSums(permstore, na.rm = TRUE) + 1)/(validn + 1)
     }
diff --git a/data/BCI.env.rda b/data/BCI.env.rda
new file mode 100644
index 0000000..13ffee6
Binary files /dev/null and b/data/BCI.env.rda differ
diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd
index 939ca1b..d6f3e06 100644
--- a/inst/NEWS.Rd
+++ b/inst/NEWS.Rd
@@ -2,6 +2,85 @@
 \title{vegan News}
 \encoding{UTF-8}
 
+\section{Changes in version 2.3-1}{
+
+  \subsection{BUG FIXES}{
+    \itemize{
+
+      \item Permutation tests did not always correctly recognize ties
+      with the observed statistic and this could result in too low
+      \eqn{P}-values. This would happen in particular when all predictor
+      variables were factors (classes). The changes concern functions
+      \code{adonis}, \code{anosim}, \code{anova} and \code{permutest}
+      functions for \code{cca}, \code{rda} and \code{capscale},
+      \code{permutest} for \code{betadisper}, \code{envfit},
+      \code{mantel} and \code{mantel.partial}, \code{mrpp}, \code{mso},
+      \code{oecosimu}, \code{ordiareatest}, \code{protest} and
+      \code{simper}. This also fixes issues
+      \href{https://github.com/vegandevs/vegan/issues/120}{#120} and
+      \href{https://github.com/vegandevs/vegan/issues/132}{#132} in
+      GitHub.
+
+      \item Automated model building in constrained ordination
+      (\code{cca}, \code{rda}, \code{capscale}) with \code{step},
+      \code{ordistep} and \code{ordiR2step} could fail if there were
+      aliased candidate variables, or constraints that were completely
+      explained by other variables already in the model. This was a
+      regression introduced in \pkg{vegan} 2.2-0.
+
+      \item Constrained ordination methods \code{cca}, \code{rda} and
+      \code{capscale} treat character variables as factors in analysis,
+      but did not return their centroids for plotting.
+
+      \item Recovery of original data in \code{metaMDS} when computing
+      WA scores for species would fail if the expression supplied to
+      argument \code{comm} was long & got deparsed to multiple
+      strings. \code{metaMDSdist} now returns the (possibly modified)
+      data frame of community data \code{comm} as attribute
+      \code{"comm"} of the returned \code{dist} object. \code{metaMDS}
+      now uses this to compute the WA species scores for the NMDS. In
+      addition, the deparsed expression for \code{comm} is now robust to
+      long expressions.  Reported by Richard Telford.
+
+      \item \code{metaMDS} and \code{monoMDS} rejected dissimilarities
+      with missing values.
+
+      \item Function \code{rarecurve} did not check its input and this
+      could cause confusing error messages. Now function checks that
+      input data are integers that can be interpreted as counts on
+      individuals and all sampling units have some species. Unchecked
+      bad inputs were the reason for problems reported in
+      \href{http://stackoverflow.com/questions/30856909/error-while-using-rarecurve-in-r}{Stackoverflow}.
+
+    }
+  } % bug fixes
+
+  \subsection{NEW FEATURES AND FUNCTIONS}{
+    \itemize{
+      
+     \item Scaling of ordination axes in \code{cca}, \code{rda} and
+     \code{capscale} can now be expressed with descriptive strings
+     \code{"none"}, \code{"sites"}, \code{"species"} or
+     \code{"symmetric"} to tell which kind of scores should be scaled by
+     eigenvalues. These can be further modified with arguments
+     \code{hill} in \code{cca} and \code{correlation} in \code{rda}. The
+     old numeric scaling can still be used.
+
+     \item The permutation data can be extracted from \code{anova}
+     results of constrained ordination (\code{cca}, \code{rda},
+     \code{capscale}) and further analysed with \code{permustats}
+     function.
+
+     \item New data set \code{BCI.env} of site information for the Barro
+     Colorado Island tree community data. Most useful variables are the
+     UTM coordinates of sample plots. Other variables are constant or
+     nearly constant and of little use in normal analysis.
+     
+   }
+  } % new features and functions
+
+}
+
 \section{Changes in version 2.3-0}{
 
   \subsection{BUG FIXES}{
diff --git a/inst/doc/FAQ-vegan.pdf b/inst/doc/FAQ-vegan.pdf
index 3ca9203..c4044c7 100644
Binary files a/inst/doc/FAQ-vegan.pdf and b/inst/doc/FAQ-vegan.pdf differ
diff --git a/inst/doc/NEWS.html b/inst/doc/NEWS.html
index 4c59561..e36b4e9 100644
--- a/inst/doc/NEWS.html
+++ b/inst/doc/NEWS.html
@@ -7,6 +7,98 @@
 
 <h2>vegan News</h2>
 
+<h3>Changes in version 2.3-1</h3>
+
+
+
+<h4>BUG FIXES</h4>
+
+
+<ul>
+<li><p> Permutation tests did not always correctly recognize ties
+with the observed statistic and this could result in too low
+<i>P</i>-values. This would happen in particular when all predictor
+variables were factors (classes). The changes concern functions
+<code>adonis</code>, <code>anosim</code>, <code>anova</code> and <code>permutest</code>
+functions for <code>cca</code>, <code>rda</code> and <code>capscale</code>,
+<code>permutest</code> for <code>betadisper</code>, <code>envfit</code>,
+<code>mantel</code> and <code>mantel.partial</code>, <code>mrpp</code>, <code>mso</code>,
+<code>oecosimu</code>, <code>ordiareatest</code>, <code>protest</code> and
+<code>simper</code>. This also fixes issues
+<a href="https://github.com/vegandevs/vegan/issues/120">#120</a> and
+<a href="https://github.com/vegandevs/vegan/issues/132">#132</a> in
+GitHub.
+</p>
+</li>
+<li><p> Automated model building in constrained ordination
+(<code>cca</code>, <code>rda</code>, <code>capscale</code>) with <code>step</code>,
+<code>ordistep</code> and <code>ordiR2step</code> could fail if there were
+aliased candidate variables, or constraints that were completely
+explained by other variables already in the model. This was a
+regression introduced in <span class="pkg">vegan</span> 2.2-0.
+</p>
+</li>
+<li><p> Constrained ordination methods <code>cca</code>, <code>rda</code> and
+<code>capscale</code> treat character variables as factors in analysis,
+but did not return their centroids for plotting.
+</p>
+</li>
+<li><p> Recovery of original data in <code>metaMDS</code> when computing
+WA scores for species would fail if the expression supplied to
+argument <code>comm</code> was long & got deparsed to multiple
+strings. <code>metaMDSdist</code> now returns the (possibly modified)
+data frame of community data <code>comm</code> as attribute
+<code>"comm"</code> of the returned <code>dist</code> object. <code>metaMDS</code>
+now uses this to compute the WA species scores for the NMDS. In
+addition, the deparsed expression for <code>comm</code> is now robust to
+long expressions.  Reported by Richard Telford.
+</p>
+</li>
+<li> <p><code>metaMDS</code> and <code>monoMDS</code> rejected dissimilarities
+with missing values.
+</p>
+</li>
+<li><p> Function <code>rarecurve</code> did not check its input and this
+could cause confusing error messages. Now function checks that
+input data are integers that can be interpreted as counts on
+individuals and all sampling units have some species. Unchecked
+bad inputs were the reason for problems reported in
+<a href="http://stackoverflow.com/questions/30856909/error-while-using-rarecurve-in-r">Stackoverflow</a>.
+</p>
+</li></ul>
+
+ 
+
+
+<h4>NEW FEATURES AND FUNCTIONS</h4>
+
+
+<ul>
+<li><p> Scaling of ordination axes in <code>cca</code>, <code>rda</code> and
+<code>capscale</code> can now be expressed with descriptive strings
+<code>"none"</code>, <code>"sites"</code>, <code>"species"</code> or
+<code>"symmetric"</code> to tell which kind of scores should be scaled by
+eigenvalues. These can be further modified with arguments
+<code>hill</code> in <code>cca</code> and <code>correlation</code> in <code>rda</code>. The
+old numeric scaling can still be used.
+</p>
+</li>
+<li><p> The permutation data can be extracted from <code>anova</code>
+results of constrained ordination (<code>cca</code>, <code>rda</code>,
+<code>capscale</code>) and further analysed with <code>permustats</code>
+function.
+</p>
+</li>
+<li><p> New data set <code>BCI.env</code> of site information for the Barro
+Colorado Island tree community data. Most useful variables are the
+UTM coordinates of sample plots. Other variables are constant or
+nearly constant and of little use in normal analysis.
+</p>
+</li></ul>
+
+ 
+
+
 <h3>Changes in version 2.3-0</h3>
 
 
diff --git a/inst/doc/decision-vegan.pdf b/inst/doc/decision-vegan.pdf
index 9f3877f..a2ae6fa 100644
Binary files a/inst/doc/decision-vegan.pdf and b/inst/doc/decision-vegan.pdf differ
diff --git a/inst/doc/diversity-vegan.pdf b/inst/doc/diversity-vegan.pdf
index 48db583..d329def 100644
Binary files a/inst/doc/diversity-vegan.pdf and b/inst/doc/diversity-vegan.pdf differ
diff --git a/inst/doc/intro-vegan.pdf b/inst/doc/intro-vegan.pdf
index fa58dd7..944f661 100644
Binary files a/inst/doc/intro-vegan.pdf and b/inst/doc/intro-vegan.pdf differ
diff --git a/man/BCI.Rd b/man/BCI.Rd
index f2d64fb..2481486 100644
--- a/man/BCI.Rd
+++ b/man/BCI.Rd
@@ -1,12 +1,17 @@
 \encoding{UTF-8}
 \name{BCI}
 \alias{BCI}
+\alias{BCI.env}
 \docType{data}
 \title{Barro Colorado Island Tree Counts}
 \description{
-  Tree counts in 1-hectare plots in the Barro Colorado Island.
+  Tree counts in 1-hectare plots in the Barro Colorado Island and
+  associated site information.
+}
+\usage{
+data(BCI)
+data(BCI.env)
 }
-\usage{data(BCI)}
 \format{
   
   A data frame with 50 plots (rows) of 1 hectare with counts of trees
@@ -17,6 +22,18 @@
   \url{http://datadryad.org/resource/doi:10.5061/dryad.63q27} (Zanne
   et al., 2014).
 
+  For \code{BCI.env}, a data frame with 50 plots (rows) and six site
+  variables:
+
+  \describe{
+    \item{\code{UTM.EW}: }{UTM coordinates (zone 17N) East-West}
+    \item{\code{UTM.NS}: }{UTM coordinates (zone 17N) North-South}
+    \item{\code{Precipitation}: }{Precipitation in mm per year}
+    \item{\code{Elevation}: }{Elevation in m above sea level}
+    \item{\code{Age.cat}: }{Forest age category}
+    \item{\code{Geology}: }{The Underlying geological formation}
+  }
+
  }
 \details{
   Data give the numbers of trees at least 10 cm in
@@ -27,8 +44,11 @@
   The data frame contains only the Barro Colorado Island subset of the
   original data.
 
-  The quadrats are located in a regular grid. See \code{examples} for the
-  coordinates. 
+  The quadrats are located in a regular grid. See \code{BCI.env} for the
+  coordinates.
+
+  A full description of the site information in \code{BCI.env} is given
+  in Pyke et al (2001)
 
 }
 \source{
@@ -52,14 +72,14 @@
   of angiosperms into freezing environments. \emph{Nature}
   doi:10.1038/nature12872 (published online Dec 22, 2013).
 
+  Pyke, C. R., Condit, R., Aguilar, S., & Lao, S. (2001). Floristic
+  composition across a climatic gradient in a neotropical lowland
+  forest. \emph{Journal of Vegetation Science} 12, 553--566.
+  doi:10.2307/3237007 
+
 }
-\seealso{\code{\link[BiodiversityR]{BCI.env}} in \pkg{BiodiversityR}
-  package for environmental data  (coordinates are given below in the
-  \code{examples}).}  
 \examples{
-data(BCI)
-## UTM Coordinates (in metres)
-UTM.EW <- rep(seq(625754, 626654, by=100), each=5)
-UTM.NS <- rep(seq(1011569,  1011969, by=100), len=50)
+data(BCI, BCI.env)
+head(BCI.env)
 }
 \keyword{datasets}
diff --git a/man/adipart.Rd b/man/adipart.Rd
index 5df308a..5b79fb7 100644
--- a/man/adipart.Rd
+++ b/man/adipart.Rd
@@ -145,8 +145,10 @@ hiersimu(...)
 \author{
 
   \enc{Péter Sólymos}{Peter Solymos}, \email{solymos at ualberta.ca}}
-  \seealso{See \code{\link{oecosimu}} for permutation settings and
-  calculating \eqn{p}-values.  }
+
+\seealso{See \code{\link{oecosimu}} for permutation settings and
+  calculating \eqn{p}-values. \code{\link{multipart}} for multiplicative
+  diversity partitioning.}
 
 \examples{
 ## NOTE: 'nsimul' argument usually needs to be >= 99
diff --git a/man/anova.cca.Rd b/man/anova.cca.Rd
index baf242d..7509f60 100644
--- a/man/anova.cca.Rd
+++ b/man/anova.cca.Rd
@@ -145,7 +145,10 @@
 
 \value{ 
   The function \code{anova.cca} calls \code{permutest.cca} and fills an
-  \code{\link{anova}} table.  
+  \code{\link{anova}} table. Additional attributes are 
+  \code{Random.seed} (the random seeds used), 
+  \code{control} (the permutation design, see \link[permute]{how}) and 
+  \code{F.perm} (the permuted test statistics).
 }
 
 \note{
diff --git a/man/biplot.rda.Rd b/man/biplot.rda.Rd
index b544bc3..77a8790 100644
--- a/man/biplot.rda.Rd
+++ b/man/biplot.rda.Rd
@@ -6,9 +6,9 @@
   Draws a PCA biplot with species scores indicated by biplot arrows
 }
 \usage{
-\method{biplot}{rda}(x, choices = c(1, 2), scaling = 2,
+\method{biplot}{rda}(x, choices = c(1, 2), scaling = "species",
        display = c("sites", "species"), type, xlim, ylim, col = c(1,2), 
-       const, ...)
+       const, correlation = FALSE, ...)
 }
 
 \arguments{
@@ -21,7 +21,19 @@
     scaling values in \code{rda}, species scores are divided by standard
     deviation of each species and multiplied with an equalizing
     constant. Unscaled raw scores stored in the result can be accessed
-    with \code{scaling = 0}.}
+    with \code{scaling = 0}.
+
+    The type of scores can also be specified as one of \code{"none"},
+    \code{"sites"}, \code{"species"}, or \code{"symmetric"}, which
+    correspond to the values \code{0}, \code{1}, \code{2}, and \code{3}
+    respectively. Argument \code{correlation} can be used in combination
+    with these character descriptions to get the corresponding negative
+    value.
+  }
+  \item{correlation}{logical; if \code{scaling} is a character
+    description of the scaling type, \code{correlation} can be used to
+    select correlation-like scores for PCA. See argument \code{scaling}
+    for details.}
   \item{display}{Scores shown.  These must some of the alternatives
     \code{"species"} for species scores, and/or \code{"sites"} for site
     scores.}
@@ -68,9 +80,9 @@
 \examples{
 data(dune)
 mod <- rda(dune, scale = TRUE)
-biplot(mod, scaling = 3)
+biplot(mod, scaling = "symmetric")
 
 ## different type for species and site scores
-biplot(mod, scaling = 3, type = c("text", "points"))
+biplot(mod, scaling = "symmetric", type = c("text", "points"))
 }
 \keyword{hplot}
diff --git a/man/cca.Rd b/man/cca.Rd
index 5b0a625..8a70748 100644
--- a/man/cca.Rd
+++ b/man/cca.Rd
@@ -131,7 +131,7 @@
   constraints.  However, the curve artefact can be avoided only with a
   low number of constraints that do not have a curvilinear relation with
   each other.  The curve can reappear even with two badly chosen
-  constraints or a single factor.  Although the formula interface makes
+  constraints or a single factor.  Although the formula interface makes it
   easy to include polynomial or interaction terms, such terms often
   produce curved artefacts (that are difficult to interpret), these
   should probably be avoided.
@@ -171,7 +171,7 @@
   vignette with this package.
 }
 \references{ The original method was by ter Braak, but the current
-  implementations follows Legendre and Legendre.
+  implementation follows Legendre and Legendre.
 
   Legendre, P. and Legendre, L. (2012) \emph{Numerical Ecology}. 3rd English
   ed. Elsevier.
diff --git a/man/diversity.Rd b/man/diversity.Rd
index 5fdeb21..0307ffd 100644
--- a/man/diversity.Rd
+++ b/man/diversity.Rd
@@ -1,27 +1,16 @@
 \encoding{UTF-8}
 \name{diversity}
 \alias{diversity}
-\alias{rarefy}
-\alias{rrarefy}
-\alias{drarefy}
-\alias{rarecurve}
-\alias{rareslope}
 \alias{fisher.alpha}
 \alias{specnumber}
 
-\title{ Ecological Diversity Indices and Rarefaction Species Richness }
+\title{Ecological Diversity Indices}
 
-\description{ Shannon, Simpson, and Fisher diversity indices
-and rarefied species richness for community ecologists.  }
+\description{ Shannon, Simpson, and Fisher diversity indices and species
+  richness.  }
 
 \usage{
 diversity(x, index = "shannon", MARGIN = 1, base = exp(1))
-rarefy(x, sample, se = FALSE, MARGIN = 1)
-rrarefy(x, sample)
-drarefy(x, sample)
-rarecurve(x, step = 1, sample, xlab = "Sample Size", ylab = "Species",
-          label = TRUE, col, lty, ...)
-rareslope(x, sample)
 fisher.alpha(x, MARGIN = 1, ...)
 specnumber(x, groups, MARGIN = 1)
 }
@@ -32,20 +21,9 @@ specnumber(x, groups, MARGIN = 1)
     \code{"simpson"} or \code{"invsimpson"}.}
   \item{MARGIN}{Margin for which the index is computed. }
   \item{base}{ The logarithm \code{base} used in \code{shannon}.}
-  \item{sample}{Subsample size for rarefying community, either a single
-    value or a vector.}
-  \item{se}{Estimate standard errors.}
-  \item{step}{Step size for sample sizes in rarefaction curves.}
-  \item{xlab, ylab}{Axis labels in plots of rarefaction curves.}
-  \item{label}{Label rarefaction curves by rownames of \code{x}
-    (logical).}
-  \item{col, lty}{plotting colour and line type, see
-    \code{\link{par}}. Can be a vector of length \code{nrow(x)}, one per
-    sample, and will be extended to such a length internally.}
   \item{groups}{A grouping factor: if given, finds the total number of
     species in each group.}
-  \item{...}{Parameters passed to \code{\link{nlm}}, or to \code{\link{plot}}, 
-    \code{\link{lines}} and \code{\link{ordilabel}} in \code{rarecurve}.}
+  \item{...}{Parameters passed to the function.}
 }
 \details{
   Shannon or Shannon--Weaver (or Shannon--Wiener) index is defined as
@@ -59,40 +37,6 @@ specnumber(x, groups, MARGIN = 1)
     sum p_i^2}. Choice \code{simpson} returns \eqn{1-D} and
   \code{invsimpson} returns \eqn{1/D}.
  
-  Function \code{rarefy} gives the expected species richness in random
-  subsamples of size \code{sample} from the community. The size of
-  \code{sample} should be smaller than total community size, but the
-  function will work for larger \code{sample} as well (with a warning)
-  and return non-rarefied species richness (and standard error =
-  0). If \code{sample} is a vector, rarefaction of all observations is
-  performed for each sample size separately.  Rarefaction can be
-  performed only with genuine counts of individuals.  The function
-  \code{rarefy} is based on Hurlbert's (1971) formulation, and the
-  standard errors on Heck et al. (1975).
-
-  Function \code{rrarefy} generates one randomly rarefied community data
-  frame or vector of given \code{sample} size. The \code{sample} can be
-  a vector giving the sample sizes for each row, and its values must be
-  less or equal to observed number of individuals. The random
-  rarefaction is made without replacement so that the variance of
-  rarefied communities is rather related to rarefaction proportion than
-  to to the size of the \code{sample}.
-
-  Function \code{drarefy} returns probabilities that species occur in a
-  rarefied community of size \code{sample}. The \code{sample} can be a
-  vector giving the sample sizes for each row.
-
-  Function \code{rarecurve} draws a rarefaction curve for each row of
-  the input data. The rarefaction curves are evaluated using the
-  interval of \code{step} sample sizes, always including 1 and total
-  sample size.  If \code{sample} is specified, a vertical line is
-  drawn at \code{sample} with horizontal lines for the rarefied
-  species richnesses.
-
-  Function \code{rareslope} calculates the slope of \code{rarecurve}
-  (derivative of \code{rarefy}) at given \code{sample} size; the
-  \code{sample} need not be an integer.
-
   \code{fisher.alpha} estimates the \eqn{\alpha} parameter of
   Fisher's logarithmic series (see \code{\link{fisherfit}}). 
   The estimation is possible only for genuine
@@ -114,26 +58,11 @@ specnumber(x, groups, MARGIN = 1)
   inverse Simpson is asymptotically equal to rarefied species richness
   in sample of two individuals, and Fisher's \eqn{\alpha} is very
   similar to inverse Simpson.
+
 }
 
 \value{
-  A vector of diversity indices or rarefied species richness values. With
-  a single \code{sample} and \code{se = TRUE}, function \code{rarefy}
-  returns a 2-row matrix 
-  with rarefied richness (\code{S}) and its standard error
-  (\code{se}). If \code{sample} is a vector in \code{rarefy}, the
-  function returns a matrix with a column for each \code{sample} size,
-  and if \code{se = TRUE}, rarefied richness and its standard error are
-  on consecutive lines.
-
-  Function \code{rarecurve} returns \code{\link{invisible}} list of
-  \code{rarefy} results corresponding each drawn curve.
-
-  With option \code{se = TRUE}, function \code{fisher.alpha} returns a
-  data frame with items for \eqn{\alpha} (\code{alpha}), its approximate
-  standard errors (\code{se}), residual degrees of freedom
-  (\code{df.residual}), and the \code{code} returned by
-  \code{\link{nlm}} on the success of estimation. 
+  A vector of diversity indices or numbers of species. 
 }
 
 \references{
@@ -141,19 +70,21 @@ specnumber(x, groups, MARGIN = 1)
   between the number of species and the number of individuals in a
   random sample of animal population. \emph{Journal of Animal Ecology}
   \strong{12}, 42--58.
-
-  Heck, K.L., van Belle, G. & Simberloff, D. (1975). Explicit
-  calculation of the rarefaction diversity measurement and the
-  determination of sufficient sample size. \emph{Ecology} \strong{56},
-  1459--1461.  
   
   Hurlbert, S.H. (1971). The nonconcept of species diversity: a critique
   and alternative parameters. \emph{Ecology} \strong{52}, 577--586.
  
 }
 
-\seealso{Function \code{renyi} for generalized \enc{Rényi}{Renyi}
-  diversity and Hill numbers.}
+\seealso{These functions calculate only some basic indices, but many
+  others can be derived with them (see Examples). Facilities related to
+  diversity are discussed in a \pkg{vegan} vignette that can be read
+  with command \code{vegandocs("diversity")}.  Functions
+  \code{\link{renyi}} and \code{\link{tsallis}} estimate a series of
+  generalized diversity indices. Function \code{\link{rarefy}} finds
+  estimated number of species for given sample size. Beta diversity can
+  be estimated with \code{\link{betadiver}}. Diversities can be
+  partitioned with \code{\link{adipart}} and \code{\link{multipart}}. }
 
 \author{ Jari Oksanen  and  Bob O'Hara (\code{fisher.alpha}).}
 
@@ -162,7 +93,7 @@ data(BCI)
 H <- diversity(BCI)
 simp <- diversity(BCI, "simpson")
 invsimp <- diversity(BCI, "inv")
-## Unbiased Simpson of Hurlbert 1971 (eq. 5):
+## Unbiased Simpson (Hurlbert 1971, eq. 5) with rarefy:
 unbias.simp <- rarefy(BCI, 2) - 1
 ## Fisher alpha
 alpha <- fisher.alpha(BCI)
@@ -177,12 +108,6 @@ data(dune.env)
 alpha <- with(dune.env, tapply(specnumber(dune), Management, mean))
 gamma <- with(dune.env, specnumber(dune, Management))
 gamma/alpha - 1
-## Rarefaction
-(raremax <- min(rowSums(BCI)))
-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)
 }
 \keyword{ univar }
 
diff --git a/man/monoMDS.Rd b/man/monoMDS.Rd
index 0696aa2..cbdac7c 100644
--- a/man/monoMDS.Rd
+++ b/man/monoMDS.Rd
@@ -138,7 +138,7 @@ monoMDS(dist, y, k = 2, model = c("global", "local", "linear", "hybrid"),
   components so that the first dimension shows the major variation.
   It is possible to rotate the solution so that the first axis is
   parallel to a given environmental variable using function
-  \code{\link{metaMDSrotate}}.
+  \code{\link{MDSrotate}}.
 
 }
 
diff --git a/man/permustats.Rd b/man/permustats.Rd
index 22990e8..b4049e3 100644
--- a/man/permustats.Rd
+++ b/man/permustats.Rd
@@ -1,7 +1,9 @@
+\encoding{UTF-8}
 \name{permustats}
 \alias{permustats}
 \alias{permustats.adonis}
 \alias{permustats.anosim}
+\alias{permustats.anova.cca}
 \alias{permustats.CCorA}
 \alias{permustats.envfit}
 \alias{permustats.factorfit}
@@ -91,13 +93,11 @@ permustats(x, ...)
   arguments to their underlying functions; see their documentation.
 
   The \code{permustats} can extract permutation statistics from the
-  results of \code{\link{adonis}}, \code{\link{anosim}},
-  \code{\link{mantel}}, \code{\link{mantel.partial}},
+  results of \code{\link{adonis}}, \code{\link{anosim}}, 
+  \code{\link{anova.cca}}, \code{\link{mantel}}, \code{\link{mantel.partial}},
   \code{\link{mrpp}}, \code{\link{oecosimu}}, \code{\link{ordiareatest}},
   \code{\link{permutest.cca}}, \code{\link{protest}}, and
-  \code{\link{permutest.betadisper}}. NB, there is no \code{permustats}
-  method for \code{\link{anova.cca}}, but only for
-  \code{\link{permutest.cca}}.
+  \code{\link{permutest.betadisper}}. 
 
 }
 
@@ -115,7 +115,7 @@ permustats(x, ...)
   Jari Oksanen with contributions from Gavin L. Simpson
   (\code{permustats.permutest.betadisper} method and related
   modifications to \code{summary.permustats} and the \code{print}
-  method.
+  method) and Eduard \enc{Szöcs}{Szoecs} (\code{permustats.anova.cca).}
 }
 
 \seealso{
diff --git a/man/plot.cca.Rd b/man/plot.cca.Rd
index 7506054..b35960d 100644
--- a/man/plot.cca.Rd
+++ b/man/plot.cca.Rd
@@ -19,16 +19,22 @@
 }
 \usage{
 \method{plot}{cca}(x, choices = c(1, 2), display = c("sp", "wa", "cn"),
-         scaling = 2, type, xlim, ylim, const, ...)
-\method{text}{cca}(x, display = "sites", labels, choices = c(1, 2), scaling = 2,
-    arrow.mul, head.arrow = 0.05, select, const, axis.bp = TRUE, ...)
-\method{points}{cca}(x, display = "sites", choices = c(1, 2), scaling = 2,
-    arrow.mul, head.arrow = 0.05, select, const, axis.bp = TRUE, ...)
-\method{scores}{cca}(x, choices=c(1,2), display=c("sp","wa","cn"), scaling=2, ...)
-\method{scores}{rda}(x, choices=c(1,2), display=c("sp","wa","cn"), scaling=2, 
-    const, ...)
-\method{summary}{cca}(object, scaling = 2, axes = 6, display = c("sp", "wa", 
-    "lc", "bp", "cn"), digits = max(3, getOption("digits") - 3), ...)
+     scaling = "species", type, xlim, ylim, const,
+     correlation = FALSE, hill = FALSE, ...)
+\method{text}{cca}(x, display = "sites", labels, choices = c(1, 2),
+     scaling = "species", arrow.mul, head.arrow = 0.05, select, const,
+     axis.bp = TRUE, correlation = FALSE, hill = FALSE, ...)
+\method{points}{cca}(x, display = "sites", choices = c(1, 2),
+       scaling = "species", arrow.mul, head.arrow = 0.05, select, const,
+       axis.bp = TRUE, correlation = FALSE, hill = FALSE, ...)
+\method{scores}{cca}(x, choices = c(1,2), display = c("sp","wa","cn"),
+       scaling = "species", hill = FALSE, ...)
+\method{scores}{rda}(x, choices = c(1,2), display = c("sp","wa","cn"),
+       scaling = "species", const, correlation = FALSE, ...)
+\method{summary}{cca}(object, scaling = "species", axes = 6,
+        display = c("sp", "wa", "lc", "bp", "cn"),
+        digits = max(3, getOption("digits") - 3),
+        correlation = FALSE, hill = FALSE, ...)
 \method{print}{summary.cca}(x, digits = x$digits, head = NA, tail = head, ...)
 \method{head}{summary.cca}(x, n = 6, tail = 0, ...)
 \method{tail}{summary.cca}(x, n = 6, head = 0, ...)
@@ -37,25 +43,36 @@
 \arguments{
   \item{x, object}{A \code{cca} result object.}
     \item{choices}{Axes shown.}
-  \item{display}{Scores shown.  These must include some of the alternatives
-    \code{species} or \code{sp} for species scores, \code{sites} or
-    \code{wa} for site scores, \code{lc} for linear constraints or ``LC
-    scores'', or \code{bp} for biplot arrows or \code{cn} for centroids
-    of factor constraints instead of an arrow.}
-   \item{scaling}{Scaling for species and site scores. Either species
+  \item{display}{Scores shown.  These must include some of the
+    alternatives \code{species} or \code{sp} for species scores,
+    \code{sites} or \code{wa} for site scores, \code{lc} for linear
+    constraints or ``LC scores'', or \code{bp} for biplot arrows or
+    \code{cn} for centroids of factor constraints instead of an arrow.}
+  \item{scaling}{Scaling for species and site scores. Either species
     (\code{2}) or site (\code{1}) scores are scaled by eigenvalues, and
     the other set of scores is left unscaled, or with \code{3} both are
     scaled symmetrically by square root of eigenvalues.  Corresponding
     negative values can be used in \code{cca} to additionally multiply
-    results with \eqn{\sqrt(1/(1-\lambda))}.  This scaling is know as
-    Hill scaling (although it has nothing to do
-    with Hill's rescaling of \code{\link{decorana}}). With corresponding
-    negative values in\code{rda},
-    species scores are divided by standard deviation of each species and
-    multiplied with an equalizing constant.
-    Unscaled raw scores stored in the result can be accessed with
-    \code{scaling = 0}. 
+    results with \eqn{\sqrt(1/(1-\lambda))}.  This scaling is know as Hill
+    scaling (although it has nothing to do with Hill's rescaling of
+    \code{\link{decorana}}). With corresponding negative values
+    in\code{rda}, species scores are divided by standard deviation of each
+    species and multiplied with an equalizing constant. Unscaled raw
+    scores stored in the result can be accessed with \code{scaling = 0}.
+
+    The type of scores can also be specified as one of \code{"none"},
+    \code{"sites"}, \code{"species"}, or \code{"symmetric"}, which
+    correspond to the values \code{0}, \code{1}, \code{2}, and \code{3}
+    respectively. Arguments \code{correlation} and \code{hill} in
+    \code{scores.rda} and \code{scores.cca} respectively can be used in
+    combination with these character descriptions to get the
+    corresponding negative value.
   }
+  \item{correlation, hill}{logical; if \code{scaling} is a character
+    description of the scaling type, \code{correlation} or \code{hill}
+    are used to select the corresponding negative scaling type; either
+    correlation-like scores or Hill's scaling for PCA/RDA and CA/CCA
+    respectively. See argument \code{scaling} for details.}
   \item{type}{Type of plot: partial match to \code{text}
     for text labels, \code{points} for points, and \code{none} for
     setting frames only.  If omitted, \code{text} is selected for
@@ -165,6 +182,14 @@ text(mod, "species", col="blue", cex=0.8)
 ## Limited output of 'summary'
 head(summary(mod), tail=2)
 ## Read description of scaling in RDA in vegan:
-\dontrun{vegandocs("decision")}}
+\dontrun{vegandocs("decision")}
+
+## 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)
+}
 \keyword{hplot}
 \keyword{aplot}
diff --git a/man/prc.Rd b/man/prc.Rd
index 811a330..47a54e5 100644
--- a/man/prc.Rd
+++ b/man/prc.Rd
@@ -17,10 +17,11 @@
 
 \usage{
 prc(response, treatment, time, ...)
-\method{summary}{prc}(object, axis = 1, scaling = 3, digits = 4, ...)
-\method{plot}{prc}(x, species = TRUE, select, scaling = 3, axis = 1, type = "l", 
-    xlab, ylab, ylim, lty = 1:5, col = 1:6, pch, legpos, cex = 0.8, 
-    ...)  
+\method{summary}{prc}(object, axis = 1, scaling = "symmetric",
+        digits = 4, correlation = FALSE, ...)
+\method{plot}{prc}(x, species = TRUE, select, scaling = "symmetric",
+     axis = 1, correlation = FALSE, type = "l", xlab, ylab, ylim,
+     lty = 1:5, col = 1:6, pch, legpos, cex = 0.8, ...)  
 }
 
 \arguments{
@@ -33,8 +34,20 @@ prc(response, treatment, time, ...)
   \item{object, x}{An \code{prc} result object.}
   \item{axis}{Axis shown (only one axis can be selected).}
   \item{scaling}{Scaling of species scores, identical to the
-    \code{scaling} in \code{\link{scores.rda}}.}
+    \code{scaling} in \code{\link{scores.rda}}.
+
+    The type of scores can also be specified as one of \code{"none"},
+    \code{"sites"}, \code{"species"}, or \code{"symmetric"}, which
+    correspond to the values \code{0}, \code{1}, \code{2}, and \code{3}
+    respectively. Argument \code{correlation} can be used in combination
+    with these character descriptions to get the corresponding negative
+    value.
+  }
   \item{digits}{Number of significant digits displayed.}
+  \item{correlation}{logical; if \code{scaling} is a character
+    description of the scaling type, \code{correlation} can be used to
+    select correlation-like scores for PCA. See argument \code{scaling}
+    for details.}
   \item{species}{Display species scores.}
   \item{select}{Vector to select displayed species. This can be a vector
     of indices or a logical vector which is \code{TRUE} for the selected
diff --git a/man/predict.cca.Rd b/man/predict.cca.Rd
index f06bbd8..ea206e2 100644
--- a/man/predict.cca.Rd
+++ b/man/predict.cca.Rd
@@ -27,7 +27,11 @@
     type = c("response", "working"), ...)
 \method{residuals}{cca}(object, ...)
 \method{predict}{cca}(object, newdata, type = c("response", "wa", "sp", "lc", "working"),
-    rank = "full", model = c("CCA", "CA"), scaling = FALSE, ...)
+        rank = "full", model = c("CCA", "CA"), scaling = "none",
+        hill = FALSE, ...)
+\method{predict}{rda}(object, newdata, type = c("response", "wa", "sp", "lc", "working"),
+        rank = "full", model = c("CCA", "CA"), scaling = "none",
+        correlation = FALSE, ...)
 \method{calibrate}{cca}(object, newdata, rank = "full", ...)
 \method{coef}{cca}(object, ...)
 \method{predict}{decorana}(object, newdata, type = c("response", "sites", "species"),
@@ -70,9 +74,13 @@
   \item{rank}{The rank or the number of axes used in the approximation.
     The default is to use all axes (full rank) of the \code{"model"} or
     all available four axes in \code{predict.decorana}.}
-  \item{scaling}{Scaling or predicted scores with the same meaning as
-    in \code{\link{cca}}, \code{\link{rda}} and
-    \code{\link{capscale}}.}
+  \item{scaling}{logical, character, or numeric; Scaling or predicted
+    scores with the same meaning as in \code{\link{cca}},
+    \code{\link{rda}} and \code{\link{capscale}}. See \code{scores.cca}
+    for further details on acceptable values.}
+  \item{correlation, hill}{logical; correlation-like scores or Hill's
+    scaling as appropriate for RDA/\code{\link{capscale}} and CCA
+    respectively. See \code{\link{scores.cca}} for additional details.}
   \item{\dots}{Other parameters to the functions.}
 }
 \details{
diff --git a/man/diversity.Rd b/man/rarefy.Rd
similarity index 50%
copy from man/diversity.Rd
copy to man/rarefy.Rd
index 5fdeb21..7db8977 100644
--- a/man/diversity.Rd
+++ b/man/rarefy.Rd
@@ -1,37 +1,26 @@
-\encoding{UTF-8}
-\name{diversity}
-\alias{diversity}
+\name{rarefy}
 \alias{rarefy}
 \alias{rrarefy}
 \alias{drarefy}
 \alias{rarecurve}
 \alias{rareslope}
-\alias{fisher.alpha}
-\alias{specnumber}
 
-\title{ Ecological Diversity Indices and Rarefaction Species Richness }
+\title{Rarefaction Species Richness}
 
-\description{ Shannon, Simpson, and Fisher diversity indices
-and rarefied species richness for community ecologists.  }
+\description{ Rarefied species richness for community ecologists.  }
 
 \usage{
-diversity(x, index = "shannon", MARGIN = 1, base = exp(1))
 rarefy(x, sample, se = FALSE, MARGIN = 1)
 rrarefy(x, sample)
 drarefy(x, sample)
 rarecurve(x, step = 1, sample, xlab = "Sample Size", ylab = "Species",
           label = TRUE, col, lty, ...)
 rareslope(x, sample)
-fisher.alpha(x, MARGIN = 1, ...)
-specnumber(x, groups, MARGIN = 1)
 }
 
 \arguments{
   \item{x}{Community data, a matrix-like object or a vector.}
-  \item{index}{Diversity index, one of \code{"shannon"},
-    \code{"simpson"} or \code{"invsimpson"}.}
   \item{MARGIN}{Margin for which the index is computed. }
-  \item{base}{ The logarithm \code{base} used in \code{shannon}.}
   \item{sample}{Subsample size for rarefying community, either a single
     value or a vector.}
   \item{se}{Estimate standard errors.}
@@ -42,22 +31,10 @@ specnumber(x, groups, MARGIN = 1)
   \item{col, lty}{plotting colour and line type, see
     \code{\link{par}}. Can be a vector of length \code{nrow(x)}, one per
     sample, and will be extended to such a length internally.}
-  \item{groups}{A grouping factor: if given, finds the total number of
-    species in each group.}
   \item{...}{Parameters passed to \code{\link{nlm}}, or to \code{\link{plot}}, 
     \code{\link{lines}} and \code{\link{ordilabel}} in \code{rarecurve}.}
 }
 \details{
-  Shannon or Shannon--Weaver (or Shannon--Wiener) index is defined as
-  \eqn{H' = -\sum_i p_i \log_{b} p_i}{H = -sum p_i log(b) p_i}, where
-  \eqn{p_i} is the proportional abundance of species \eqn{i} and \eqn{b}
-  is the base of the logarithm.  It is most popular to use natural
-  logarithms, but some argue for base \eqn{b = 2} (which makes sense,
-  but no real difference).
-
-  Both variants of Simpson's index are based on \eqn{D = \sum p_i^2}{D =
-    sum p_i^2}. Choice \code{simpson} returns \eqn{1-D} and
-  \code{invsimpson} returns \eqn{1/D}.
  
   Function \code{rarefy} gives the expected species richness in random
   subsamples of size \code{sample} from the community. The size of
@@ -93,34 +70,12 @@ specnumber(x, groups, MARGIN = 1)
   (derivative of \code{rarefy}) at given \code{sample} size; the
   \code{sample} need not be an integer.
 
-  \code{fisher.alpha} estimates the \eqn{\alpha} parameter of
-  Fisher's logarithmic series (see \code{\link{fisherfit}}). 
-  The estimation is possible only for genuine
-  counts of individuals. 
-  
-  Function \code{specnumber} finds the number of species. With
-  \code{MARGIN = 2}, it finds frequencies of species. If \code{groups}
-  is given, finds the total number of species in each group (see 
-  example on finding one kind of beta diversity with this option).
-  
-  Better stories can be told about Simpson's index than about
-  Shannon's index, and still grander narratives about
-  rarefaction (Hurlbert 1971).  However, these indices are all very
-  closely related (Hill 1973), and there is no reason to despise one
-  more than others (but if you are a graduate student, don't drag me in,
-  but obey your Professor's orders). In particular, the exponent of the
-  Shannon index is linearly related to inverse Simpson (Hill 1973)
-  although the former may be more sensitive to rare species. Moreover,
-  inverse Simpson is asymptotically equal to rarefied species richness
-  in sample of two individuals, and Fisher's \eqn{\alpha} is very
-  similar to inverse Simpson.
 }
 
 \value{
-  A vector of diversity indices or rarefied species richness values. With
-  a single \code{sample} and \code{se = TRUE}, function \code{rarefy}
-  returns a 2-row matrix 
-  with rarefied richness (\code{S}) and its standard error
+  A vector of rarefied species richness values. With a single
+  \code{sample} and \code{se = TRUE}, function \code{rarefy} returns a
+  2-row matrix with rarefied richness (\code{S}) and its standard error
   (\code{se}). If \code{sample} is a vector in \code{rarefy}, the
   function returns a matrix with a column for each \code{sample} size,
   and if \code{se = TRUE}, rarefied richness and its standard error are
@@ -128,20 +83,9 @@ specnumber(x, groups, MARGIN = 1)
 
   Function \code{rarecurve} returns \code{\link{invisible}} list of
   \code{rarefy} results corresponding each drawn curve.
-
-  With option \code{se = TRUE}, function \code{fisher.alpha} returns a
-  data frame with items for \eqn{\alpha} (\code{alpha}), its approximate
-  standard errors (\code{se}), residual degrees of freedom
-  (\code{df.residual}), and the \code{code} returned by
-  \code{\link{nlm}} on the success of estimation. 
 }
 
 \references{
-  Fisher, R.A., Corbet, A.S. & Williams, C.B. (1943). The relation
-  between the number of species and the number of individuals in a
-  random sample of animal population. \emph{Journal of Animal Ecology}
-  \strong{12}, 42--58.
-
   Heck, K.L., van Belle, G. & Simberloff, D. (1975). Explicit
   calculation of the rarefaction diversity measurement and the
   determination of sufficient sample size. \emph{Ecology} \strong{56},
@@ -152,32 +96,15 @@ specnumber(x, groups, MARGIN = 1)
  
 }
 
-\seealso{Function \code{renyi} for generalized \enc{Rényi}{Renyi}
-  diversity and Hill numbers.}
+\seealso{Use \code{\link{specaccum}} for species accumulation curves
+  where sites are sampled instead of individuals. \code{\link{specpool}}
+  extrapolates richness to an unknown sample size.}
 
-\author{ Jari Oksanen  and  Bob O'Hara (\code{fisher.alpha}).}
+\author{Jari Oksanen}
 
 \examples{
 data(BCI)
-H <- diversity(BCI)
-simp <- diversity(BCI, "simpson")
-invsimp <- diversity(BCI, "inv")
-## Unbiased Simpson of Hurlbert 1971 (eq. 5):
-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
-## Rarefaction
+S <- specnumber(BCI) # observed number of species
 (raremax <- min(rowSums(BCI)))
 Srare <- rarefy(BCI, raremax)
 plot(S, Srare, xlab = "Observed No. of Species", ylab = "Rarefied No. of Species")
diff --git a/man/specaccum.Rd b/man/specaccum.Rd
index 00ed7b8..82410b5 100644
--- a/man/specaccum.Rd
+++ b/man/specaccum.Rd
@@ -14,7 +14,7 @@
 \alias{deviance.fitspecaccum}
 \alias{specslope}
 
-\title{Species Accumulation Curves }
+\title{Species Accumulation Curves}
 \description{
   Function \code{specaccum} finds species accumulation curves or the
   number of species for a certain number of sampled sites or
@@ -96,30 +96,30 @@ specslope(object, at)
   \item{...}{Other parameters to functions.}
 }
 \details{
-  Species accumulation curves (SAC) are used to compare diversity properties
-  of community data sets using different accumulator functions. The
-  classic method is \code{"random"} which finds the mean SAC and its
-  standard deviation from random permutations of the data, or
-  subsampling without replacement (Gotelli & Colwell 2001).
-  The \code{"exact"} method finds the
-  expected SAC using the method that was independently developed by
-  Ugland et al. (2003), Colwell et al. (2004) and Kindt et al. (2006). 
-  The unconditional standard deviation for the exact SAC represents a
-  moment-based estimation that is not conditioned on the empirical data
-  set (sd for all samples > 0), unlike the conditional standard deviation
-  that was developed by Jari Oksanen (not published, sd=0 for all
-  samples). The unconditional standard deviation is based on an estimation
-  of the total extrapolated number of species in the survey area
-  (a.k.a. gamma diversity), as estimated by
-  function \code{\link{specpool}}.
-  Method \code{"coleman"} finds the expected SAC and its standard
-  deviation following Coleman et al. (1982).  All these methods are
-  based on sampling sites without replacement. In contrast, the
-  \code{method = "rarefaction"} finds the expected species richness and
-  its standard deviation by sampling individuals instead of sites.
-  It achieves this by applying function \code{\link{rarefy}} with
-  number of individuals corresponding to average number of individuals
-  per site.
+
+  Species accumulation curves (SAC) are used to compare diversity
+  properties of community data sets using different accumulator
+  functions. The classic method is \code{"random"} which finds the mean
+  SAC and its standard deviation from random permutations of the data,
+  or subsampling without replacement (Gotelli & Colwell 2001).  The
+  \code{"exact"} method finds the expected SAC using sample-based
+  rarefaction method that has been independently developed numerous
+  times (Chiarucci et al. 2008) and it is often known as Mao Tau
+  estimate (Colwell et al. 2012).  The unconditional standard deviation
+  for the exact SAC represents a moment-based estimation that is not
+  conditioned on the empirical data set (sd for all samples > 0). The
+  unconditional standard deviation is based on an estimation of the
+  extrapolated number of species in the survey area (a.k.a. gamma
+  diversity), as estimated by function \code{\link{specpool}}. The
+  conditional standard deviation that was developed by Jari Oksanen (not
+  published, sd=0 for all samples). Method \code{"coleman"} finds the
+  expected SAC and its standard deviation following Coleman et
+  al. (1982).  All these methods are based on sampling sites without
+  replacement. In contrast, the \code{method = "rarefaction"} finds the
+  expected species richness and its standard deviation by sampling
+  individuals instead of sites.  It achieves this by applying function
+  \code{\link{rarefy}} with number of individuals corresponding to
+  average number of individuals per site.
 
   Methods \code{"random"} and \code{"collector"} can take weights
   (\code{w}) that give the sampling effort for each site.  The weights
@@ -232,34 +232,27 @@ specslope(object, at)
 }
 
 \references{
+  Chiarucci, A., Bacaro, G., Rocchini, D. & Fattorini,
+  L. (2008). Discovering and rediscovering the sample-based rarefaction
+  formula in the ecological literature. \emph{Commun. Ecol.} 9:
+  121--123.
+
   Coleman, B.D, Mares, M.A., Willis, M.R. & Hsieh,
   Y. (1982). Randomness, area and species richness. \emph{Ecology} 63:
   1121--1133. 
 
-  Colwell, R.K., Mao, C.X. & Chang, J. (2004). Interpolating,
-  extrapolating, and comparing incidence-based species accumulation
-  curves. \emph{Ecology} 85: 2717--2727.
+  Colwell, R.K., Chao, A., Gotelli, N.J., Lin, S.Y., Mao, C.X., Chazdon,
+  R.L. & Longino, J.T. (2012). Models and estimators linking
+  individual-based and sample-based rarefaction, extrapolation and
+  comparison of assemblages. \emph{J. Plant Ecol.} 5: 3--21.
 
   Dengler, J. (2009). Which function describes the species-area
   relationship best? A review and empirical evaluation. 
   \emph{Journal of Biogeography} 36, 728--744.
 
-  Gotellli, N.J. & Colwell, R.K. (2001). Quantifying biodiversity:
+  Gotelli, N.J. & Colwell, R.K. (2001). Quantifying biodiversity:
   procedures and pitfalls in measurement and comparison of species
   richness. \emph{Ecol. Lett.} 4, 379--391.
-
-  Kindt, R. (2003). Exact species richness for sample-based accumulation
-  curves. \emph{Manuscript.}
-  
-  Kindt R., Van Damme, P. & Simons, A.J. (2006) Patterns of species
-  richness at varying scales in western Kenya: planning for
-  agroecosystem diversification. \emph{Biodiversity and Conservation},
-  10: 3235--3249.
-
-  Ugland, K.I., Gray, J.S. & Ellingsen, K.E. (2003). The
-  species-accumulation curve and estimation of species richness. \emph{Journal
-  of Animal Ecology} 72: 888--897.
-  
 }
 \author{Roeland Kindt \email{r.kindt at cgiar.org} and Jari Oksanen.}
 \note{
diff --git a/man/tolerance.Rd b/man/tolerance.Rd
index 46a96ae..86d7186 100644
--- a/man/tolerance.Rd
+++ b/man/tolerance.Rd
@@ -7,7 +7,7 @@
 tolerance(x, \dots)
 
 \method{tolerance}{cca}(x, choices = 1:2, which = c("species","sites"),
-    scaling = 2, useN2 = FALSE, \dots)
+          scaling = "species", useN2 = FALSE, hill = FALSE, \dots)
 }
 \description{
   Species tolerances and sample heterogeneities.
@@ -29,7 +29,11 @@ tolerance(x, \dots)
   \item{which}{character; one of \code{"species"} or \code{"sites"},
     indicating whether species tolerances or sample heterogeneities
     respectively are computed.}
-  \item{scaling}{numeric; the ordination scaling to use.}
+  \item{scaling}{character or numeric; the ordination scaling to
+    use. See \code{\link{scores.cca}} for details.}
+  \item{hill}{logical; if \code{scaling} is a character,
+    these control whether Hill's scaling is used for (C)CA
+    respectively. See \code{\link{scores.cca}} for details.}
   \item{useN2}{logical; should the bias in the tolerances /
     heterogeneities be reduced via scaling by Hill's N2?}
   \item{\dots}{arguments passed to other methods.}
diff --git a/vignettes/FAQ-vegan.pdf b/vignettes/FAQ-vegan.pdf
index 3ca9203..c4044c7 100644
Binary files a/vignettes/FAQ-vegan.pdf and b/vignettes/FAQ-vegan.pdf differ
diff --git a/vignettes/NEWS.html b/vignettes/NEWS.html
index 4c59561..e36b4e9 100644
--- a/vignettes/NEWS.html
+++ b/vignettes/NEWS.html
@@ -7,6 +7,98 @@
 
 <h2>vegan News</h2>
 
+<h3>Changes in version 2.3-1</h3>
+
+
+
+<h4>BUG FIXES</h4>
+
+
+<ul>
+<li><p> Permutation tests did not always correctly recognize ties
+with the observed statistic and this could result in too low
+<i>P</i>-values. This would happen in particular when all predictor
+variables were factors (classes). The changes concern functions
+<code>adonis</code>, <code>anosim</code>, <code>anova</code> and <code>permutest</code>
+functions for <code>cca</code>, <code>rda</code> and <code>capscale</code>,
+<code>permutest</code> for <code>betadisper</code>, <code>envfit</code>,
+<code>mantel</code> and <code>mantel.partial</code>, <code>mrpp</code>, <code>mso</code>,
+<code>oecosimu</code>, <code>ordiareatest</code>, <code>protest</code> and
+<code>simper</code>. This also fixes issues
+<a href="https://github.com/vegandevs/vegan/issues/120">#120</a> and
+<a href="https://github.com/vegandevs/vegan/issues/132">#132</a> in
+GitHub.
+</p>
+</li>
+<li><p> Automated model building in constrained ordination
+(<code>cca</code>, <code>rda</code>, <code>capscale</code>) with <code>step</code>,
+<code>ordistep</code> and <code>ordiR2step</code> could fail if there were
+aliased candidate variables, or constraints that were completely
+explained by other variables already in the model. This was a
+regression introduced in <span class="pkg">vegan</span> 2.2-0.
+</p>
+</li>
+<li><p> Constrained ordination methods <code>cca</code>, <code>rda</code> and
+<code>capscale</code> treat character variables as factors in analysis,
+but did not return their centroids for plotting.
+</p>
+</li>
+<li><p> Recovery of original data in <code>metaMDS</code> when computing
+WA scores for species would fail if the expression supplied to
+argument <code>comm</code> was long & got deparsed to multiple
+strings. <code>metaMDSdist</code> now returns the (possibly modified)
+data frame of community data <code>comm</code> as attribute
+<code>"comm"</code> of the returned <code>dist</code> object. <code>metaMDS</code>
+now uses this to compute the WA species scores for the NMDS. In
+addition, the deparsed expression for <code>comm</code> is now robust to
+long expressions.  Reported by Richard Telford.
+</p>
+</li>
+<li> <p><code>metaMDS</code> and <code>monoMDS</code> rejected dissimilarities
+with missing values.
+</p>
+</li>
+<li><p> Function <code>rarecurve</code> did not check its input and this
+could cause confusing error messages. Now function checks that
+input data are integers that can be interpreted as counts on
+individuals and all sampling units have some species. Unchecked
+bad inputs were the reason for problems reported in
+<a href="http://stackoverflow.com/questions/30856909/error-while-using-rarecurve-in-r">Stackoverflow</a>.
+</p>
+</li></ul>
+
+ 
+
+
+<h4>NEW FEATURES AND FUNCTIONS</h4>
+
+
+<ul>
+<li><p> Scaling of ordination axes in <code>cca</code>, <code>rda</code> and
+<code>capscale</code> can now be expressed with descriptive strings
+<code>"none"</code>, <code>"sites"</code>, <code>"species"</code> or
+<code>"symmetric"</code> to tell which kind of scores should be scaled by
+eigenvalues. These can be further modified with arguments
+<code>hill</code> in <code>cca</code> and <code>correlation</code> in <code>rda</code>. The
+old numeric scaling can still be used.
+</p>
+</li>
+<li><p> The permutation data can be extracted from <code>anova</code>
+results of constrained ordination (<code>cca</code>, <code>rda</code>,
+<code>capscale</code>) and further analysed with <code>permustats</code>
+function.
+</p>
+</li>
+<li><p> New data set <code>BCI.env</code> of site information for the Barro
+Colorado Island tree community data. Most useful variables are the
+UTM coordinates of sample plots. Other variables are constant or
+nearly constant and of little use in normal analysis.
+</p>
+</li></ul>
+
+ 
+
+
 <h3>Changes in version 2.3-0</h3>
 
 
diff --git a/vignettes/decision-vegan.tex b/vignettes/decision-vegan.tex
index 17e5db8..54abf74 100644
--- a/vignettes/decision-vegan.tex
+++ b/vignettes/decision-vegan.tex
@@ -9,8 +9,8 @@
 
 \date{\footnotesize{
   processed with vegan
-2.3-0
-in R Under development (unstable) (2015-05-25 r68412) on \today}}
+2.3-1
+in R Under development (unstable) (2015-09-24 r69424) on \today}}
 
 %% need no \usepackage{Sweave}
 \begin{document}
@@ -701,20 +701,20 @@ Call: cca(formula = varespec[i, ] ~ Al + K, data
 = varechem)
 
               Inertia Proportion Rank
-Total          2.0832     1.0000     
-Constrained    0.1200     0.0576    2
-Unconstrained  1.9632     0.9424   21
+Total         2.08320    1.00000     
+Constrained   0.15850    0.07608    2
+Unconstrained 1.92470    0.92392   21
 Inertia is mean squared contingency coefficient 
 
 Eigenvalues for constrained axes:
    CCA1    CCA2 
-0.08228 0.03767 
+0.12178 0.03672 
 
 Eigenvalues for unconstrained axes:
    CA1    CA2    CA3    CA4    CA5    CA6    CA7 
-0.5249 0.3452 0.2173 0.1801 0.1748 0.1155 0.0889 
+0.5038 0.3395 0.1960 0.1893 0.1573 0.1214 0.1069 
    CA8 
-0.0814 
+0.0792 
 (Showed only 8 of all 21 unconstrained eigenvalues)
 \end{Soutput}
 \end{Schunk}
@@ -742,11 +742,11 @@ remain within numerical accuracy:
 > max(residuals(proc))
 \end{Sinput}
 \begin{Soutput}
-[1] 3.149138e-14
+[1] 4.392963e-14
 \end{Soutput}
 \end{Schunk}
 In \code{cca} the difference would be somewhat larger than now
-observed 3.1491e-14 because site
+observed 4.393e-14 because site
 weights used for environmental variables are shuffled with the species
 data.
 
diff --git a/vignettes/diversity-vegan.tex b/vignettes/diversity-vegan.tex
index 45342e3..0c8195f 100644
--- a/vignettes/diversity-vegan.tex
+++ b/vignettes/diversity-vegan.tex
@@ -10,8 +10,8 @@
 \title{Vegan: ecological diversity} \author{Jari Oksanen} 
 
 \date{\footnotesize{
-  processed with vegan 2.3-0
-  in R Under development (unstable) (2015-05-25 r68412) on \today}}
+  processed with vegan 2.3-1
+  in R Under development (unstable) (2015-09-24 r69424) on \today}}
 
 %% need no \usepackage{Sweave}
 \begin{document}
@@ -346,14 +346,14 @@ log-series for a randomly selected plot is (Fig.~\ref{fig:fisher}):
 \end{Sinput}
 \begin{Soutput}
 Fisher log series model
-No. of species: 93 
-Fisher alpha:   39.21057 
+No. of species: 84 
+Fisher alpha:   31.41425 
 \end{Soutput}
 \end{Schunk}
 \begin{figure}
 \includegraphics{diversity-vegan-017}
 \caption{Fisher's log-series fitted to one randomly selected site
-  (17).}
+  (39).}
 \label{fig:fisher}
 \end{figure}
 We already saw $\alpha$ as a diversity index.
@@ -377,7 +377,7 @@ octave, and the same for all species at the octave limits occurring 2,
 the lower octave.  Function \code{prestondistr} directly maximizes
 truncated log-normal likelihood without binning data, and it is the
 recommended alternative.  Log-normal models usually fit poorly to the
-BCI data, but here our random plot (number 17):
+BCI data, but here our random plot (number 39):
 \begin{Schunk}
 \begin{Sinput}
 > prestondistr(BCI[k,])
@@ -385,18 +385,18 @@ BCI data, but here our random plot (number 17):
 \begin{Soutput}
 Preston lognormal model
 Method: maximized likelihood to log2 abundances 
-No. of species: 93 
+No. of species: 84 
 
       mode      width         S0 
- 0.5486774  1.7318443 26.3054207 
+ 0.8368316  1.7642751 22.3175690 
 
 Frequencies by Octave
-                0        1      2         3        4
-Observed 20.00000 31.00000 23.000 11.000000 3.000000
-Fitted   25.01783 25.42717 18.516  9.660439 3.611164
-                 5        6
-Observed 3.0000000 2.000000
-Fitted   0.9671599 0.185588
+                0        1        2        3        4
+Observed 15.50000 24.50000 22.00000 11.50000 5.500000
+Fitted   19.94312 22.22233 17.95813 10.52465 4.473314
+                5         6          7
+Observed 2.000000 2.0000000 1.00000000
+Fitted   1.378879 0.3082464 0.04997411
 \end{Soutput}
 \end{Schunk}
 
@@ -435,26 +435,26 @@ set gives (Fig.~\ref{fig:rad}):
 \end{Sinput}
 \begin{Soutput}
 RAD models, family poisson 
-No. of species 93, total abundance 381
-
-           par1      par2     par3    Deviance AIC    
-Null                                  138.506  390.830
-Preemption  0.050488                  134.435  388.759
-Lognormal   0.64126   1.2648           52.994  309.318
-Zipf        0.16818  -0.92746          30.855  287.179
-Mandelbrot  0.5011   -1.2287   2.0074  17.027  275.352
-           BIC    
-Null       390.830
-Preemption 391.292
-Lognormal  314.384
-Zipf       292.244
-Mandelbrot 282.949
+No. of species 84, total abundance 424
+
+           par1     par2    par3     Deviance AIC     
+Null                                 178.3939 417.2015
+Preemption  0.06056                  177.9586 418.7661
+Lognormal   0.70123  1.388            41.0778 283.8853
+Zipf        0.20332 -1.0099            8.6417 251.4493
+Mandelbrot  0.26538 -1.0885  0.36401   7.4086 252.2162
+           BIC     
+Null       417.2015
+Preemption 421.1970
+Lognormal  288.7470
+Zipf       256.3109
+Mandelbrot 259.5086
 \end{Soutput}
 \end{Schunk}
 \begin{figure}
 \includegraphics{diversity-vegan-020}
 \caption{Ranked abundance distribution models for a random plot
-  (no. 17).  The best model has the lowest \textsc{aic}.}
+  (no. 39).  The best model has the lowest \textsc{aic}.}
 \label{fig:rad}
 \end{figure}
 
@@ -813,10 +813,10 @@ the plots (but this is rarely true):
 > specpool(BCI[s,])
 \end{Sinput}
 \begin{Soutput}
-    Species    chao  chao.se  jack1 jack1.se    jack2
-All     210 223.824 7.431665 233.04 5.963086 237.4867
+    Species     chao  chao.se  jack1 jack1.se    jack2
+All     209 237.9477 14.59852 235.88 7.518298 250.1783
         boot  boot.se  n
-All 221.7912 4.001204 25
+All 221.2935 4.213909 25
 \end{Soutput}
 \end{Schunk}
 
@@ -833,12 +833,12 @@ two of these methods:
 > estimateR(BCI[k,])
 \end{Sinput}
 \begin{Soutput}
-                 17
-S.obs     93.000000
-S.chao1  126.913043
-se.chao1  14.130714
-S.ACE    137.197249
-se.ACE     6.495766
+                 39
+S.obs     84.000000
+S.chao1  108.473684
+se.chao1  11.583650
+S.ACE    116.493294
+se.ACE     5.688117
 \end{Soutput}
 \end{Schunk}
 In abundance based models $a_i$ denotes the number of species with $i$
@@ -914,14 +914,14 @@ can try:
 \end{Sinput}
 \begin{Soutput}
 Extrapolated     Observed       Veiled 
-    114.1942      93.0000      21.1942 
+    98.69681     84.00000     14.69681 
 \end{Soutput}
 \begin{Sinput}
 > veiledspec(BCI[k,])
 \end{Sinput}
 \begin{Soutput}
 Extrapolated     Observed       Veiled 
-   126.01983     93.00000     33.01983 
+   109.13968     84.00000     25.13968 
 \end{Soutput}
 \end{Schunk}
 
diff --git a/vignettes/intro-vegan.tex b/vignettes/intro-vegan.tex
index 4ccdcab..3c45662 100644
--- a/vignettes/intro-vegan.tex
+++ b/vignettes/intro-vegan.tex
@@ -8,8 +8,8 @@
 
 \date{\footnotesize{
   processed with vegan
-2.3-0
-in R Under development (unstable) (2015-05-25 r68412) on \today}}
+2.3-1
+in R Under development (unstable) (2015-09-24 r69424) on \today}}
 
 %% need no \usepackage{Sweave}
 \begin{document}
@@ -113,11 +113,9 @@ species scores to the configuration as weighted averages (function
 \end{Sinput}
 \begin{Soutput}
 Run 0 stress 0.1192678 
-Run 1 stress 0.1183187 
+Run 1 stress 0.1192678 
 ... New best solution
-... procrustes: rmse 0.02026168  max resid 0.06491274 
-Run 2 stress 0.118319 
-... procrustes: rmse 0.0001018938  max resid 0.0002761111 
+... procrustes: rmse 4.211892e-05  max resid 0.0001225318 
 *** Solution reached
 \end{Soutput}
 \begin{Sinput}
@@ -133,9 +131,9 @@ Data:     dune
 Distance: bray 
 
 Dimensions: 2 
-Stress:     0.1183187 
+Stress:     0.1192678 
 Stress type 1, weak ties
-Two convergent solutions found after 2 tries
+Two convergent solutions found after 1 tries
 Scaling: centring, PC rotation, halfchange scaling 
 Species: expanded scores based on ‘dune’ 
 \end{Soutput}
@@ -294,7 +292,7 @@ variables using permutation tests:
 ***VECTORS
 
      NMDS1   NMDS2     r2 Pr(>r)  
-A1 0.96462 0.26365 0.3649  0.015 *
+A1 0.99003 0.14087 0.3797  0.015 *
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 Permutation: free
@@ -304,14 +302,14 @@ Number of permutations: 999
 
 Centroids:
                NMDS1   NMDS2
-ManagementBF -0.4533 -0.0104
-ManagementHF -0.2635 -0.1283
-ManagementNM  0.2954  0.5791
-ManagementSF  0.1508 -0.4670
+ManagementBF -0.4474 -0.0194
+ManagementHF -0.2688 -0.1256
+ManagementNM  0.2975  0.5798
+ManagementSF  0.1503 -0.4654
 
 Goodness of fit:
                r2 Pr(>r)   
-Management 0.4133  0.004 **
+Management 0.4134  0.007 **
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 Permutation: free
@@ -342,9 +340,9 @@ Formula:
 y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
 
 Estimated degrees of freedom:
-1.59  total = 2.59 
+1.62  total = 2.62 
 
-REML score: 41.58728     
+REML score: 41.42675     
 \end{Soutput}
 \end{Schunk}
 \begin{figure}
@@ -484,7 +482,7 @@ Number of permutations: 199
 Model: cca(formula = dune ~ A1 + Management, data = dune.env)
            Df ChiSquare      F Pr(>F)   
 A1          1   0.22476 2.5245  0.015 * 
-Management  3   0.55502 2.0780  0.005 **
+Management  3   0.55502 2.0780  0.010 **
 Residual   15   1.33549                 
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
@@ -505,7 +503,7 @@ Number of permutations: 199
 
 Model: cca(formula = dune ~ A1 + Management, data = dune.env)
            Df ChiSquare      F Pr(>F)   
-A1          1   0.17594 1.9761  0.025 * 
+A1          1   0.17594 1.9761  0.035 * 
 Management  3   0.55502 2.0780  0.005 **
 Residual   15   1.33549                 
 ---
@@ -528,8 +526,8 @@ Model: cca(formula = dune ~ A1 + Management, data = dune.env)
          Df ChiSquare      F Pr(>F)   
 CCA1      1   0.31875 3.5801  0.002 **
 CCA2      1   0.23718 2.6640  0.006 **
-CCA3      1   0.13217 1.4845  0.114   
-CCA4      1   0.09168 1.0297  0.380   
+CCA3      1   0.13217 1.4845  0.102   
+CCA4      1   0.09168 1.0297  0.374   
 Residual 15   1.33549                 
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
@@ -581,10 +579,10 @@ Permutation: free
 Number of permutations: 499
 
 Model: cca(formula = dune ~ A1 + Management + Condition(Moisture), data = dune.env)
-           Df ChiSquare      F Pr(>F)  
-A1          1   0.11543 1.4190  0.108  
-Management  3   0.39543 1.6205  0.012 *
-Residual   12   0.97610                
+           Df ChiSquare      F Pr(>F)   
+A1          1   0.11543 1.4190   0.13   
+Management  3   0.39543 1.6205   0.01 **
+Residual   12   0.97610                 
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 \end{Soutput}
@@ -609,8 +607,8 @@ Number of permutations: 499
 
 Model: cca(formula = dune ~ A1 + Management + Condition(Moisture), data = dune.env)
            Df ChiSquare      F Pr(>F)   
-A1          1   0.11543 1.4190  0.270   
-Management  3   0.39543 1.6205  0.002 **
+A1          1   0.11543 1.4190  0.262   
+Management  3   0.39543 1.6205  0.004 **
 Residual   12   0.97610                 
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-cran-vegan.git



More information about the debian-med-commit mailing list