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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed May 23 23:49:43 CEST 2012


Author: gsimpson
Date: 2012-05-23 23:49:43 +0200 (Wed, 23 May 2012)
New Revision: 2180

Modified:
   pkg/vegan/R/ordipointlabel.R
   pkg/vegan/man/ordipointlabel.Rd
Log:
length check on select arg only if select is a logical vector

Modified: pkg/vegan/R/ordipointlabel.R
===================================================================
--- pkg/vegan/R/ordipointlabel.R	2012-05-23 16:47:53 UTC (rev 2179)
+++ pkg/vegan/R/ordipointlabel.R	2012-05-23 21:49:43 UTC (rev 2180)
@@ -14,10 +14,11 @@
     if(!missing(select)) {
         if(isTRUE(all.equal(length(display), 1L))) {
             ## check `select` and length of scores match
-            if(isTRUE(all.equal(length(select), NROW(xy[[1]])))) {
+            if(is.logical(select) &&
+               !isTRUE(all.equal(length(select), NROW(xy[[1]])))) {
+                warning("Length of logical vector 'select' does not match the number of scores.\nIgnoring 'select'.")
+            } else {
                 xy[[1]] <- xy[[1]][select, , drop = FALSE]
-            } else {
-                warning("Length of 'select' does not match the number of scores.\nIgnoring 'select'.")
             }
         } else {
             warning("'select' does not apply when plotting more than one set of scores.\n'select' was ignored.")

Modified: pkg/vegan/man/ordipointlabel.Rd
===================================================================
--- pkg/vegan/man/ordipointlabel.Rd	2012-05-23 16:47:53 UTC (rev 2179)
+++ pkg/vegan/man/ordipointlabel.Rd	2012-05-23 21:49:43 UTC (rev 2180)
@@ -28,7 +28,8 @@
     vector which is \code{TRUE} for displayed items or a vector of indices
     of displayed items. \code{select} is only used if a single set of
     scores is being plotted (i.e. \code{length(display) == 1}),
-    otherwise it is ignored.}
+    otherwise it is ignored and a warning issued. If a logical vector is
+    used, it must have the same length as the scores plotted.}
   \item{\dots}{Other arguments passed to \code{\link{points}} and
   \code{\link{text}}.}
 }



More information about the Vegan-commits mailing list