[Vegan-commits] r2189 - in branches/2.0: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat May 26 07:35:44 CEST 2012


Author: jarioksa
Date: 2012-05-26 07:35:44 +0200 (Sat, 26 May 2012)
New Revision: 2189

Modified:
   branches/2.0/R/ordipointlabel.R
   branches/2.0/inst/ChangeLog
   branches/2.0/inst/NEWS.Rd
   branches/2.0/man/ordipointlabel.Rd
Log:
merge r2178,2180: ordipointlabel gained 'select'

Modified: branches/2.0/R/ordipointlabel.R
===================================================================
--- branches/2.0/R/ordipointlabel.R	2012-05-26 05:25:38 UTC (rev 2188)
+++ branches/2.0/R/ordipointlabel.R	2012-05-26 05:35:44 UTC (rev 2189)
@@ -1,13 +1,29 @@
 ### Modelled after maptools:::pointLabel.
 `ordipointlabel` <-
     function(x, display = c("sites", "species"), choices = c(1,2), col=c(1,2),
-             pch=c("o","+"), font = c(1,1), cex=c(0.8, 0.8), add = FALSE, ...)
+             pch=c("o","+"), font = c(1,1), cex=c(0.8, 0.8), add = FALSE,
+             select, ...)
 {
     xy <- list()
     ## Some 'scores' accept only one 'display': a workaround
     for (nm in display)
         xy[[nm]] <- scores(x, display = nm, choices = choices, ...)
     ##xy <- scores(x, display = display, choices = choices, ...)
+    ## remove `select`ed observations from scores as per text.cca
+    ## only useful if we are displaying only one set of scores
+    if(!missing(select)) {
+        if(isTRUE(all.equal(length(display), 1L))) {
+            ## check `select` and length of scores match
+            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("'select' does not apply when plotting more than one set of scores.\n'select' was ignored.")
+        }
+    }
     if (length(display) > 1) {
         col <- rep(col, sapply(xy, nrow))
         pch <- rep(pch, sapply(xy, nrow))

Modified: branches/2.0/inst/ChangeLog
===================================================================
--- branches/2.0/inst/ChangeLog	2012-05-26 05:25:38 UTC (rev 2188)
+++ branches/2.0/inst/ChangeLog	2012-05-26 05:35:44 UTC (rev 2189)
@@ -3,7 +3,8 @@
 VEGAN RELEASE VERSIONS at http://cran.r-project.org/
 
 Version 2.0-4 (opened March 9, 2012)
-
+	
+	* merge r2178, 2180: ordipointlabel gains 'select' argument.
 	* merge r2173-2176, 2185: ordihull labels, semintransparent
 	colours in ordihull & ordiellipse.
 	* merge r2170: bioenv accepts dissimilarities as input.

Modified: branches/2.0/inst/NEWS.Rd
===================================================================
--- branches/2.0/inst/NEWS.Rd	2012-05-26 05:25:38 UTC (rev 2188)
+++ branches/2.0/inst/NEWS.Rd	2012-05-26 05:35:44 UTC (rev 2189)
@@ -60,6 +60,10 @@
         \code{ordihull} puts labels (with argument \code{label = TRUE})
         now in the real polygon centre.
 
+      \item Function \code{ordipointlabel} gained argument to
+        \code{select} only some of the items for plotting. The
+        argument can be used only with one set of points.
+
     }
   } % end new features 	 
 

Modified: branches/2.0/man/ordipointlabel.Rd
===================================================================
--- branches/2.0/man/ordipointlabel.Rd	2012-05-26 05:25:38 UTC (rev 2188)
+++ branches/2.0/man/ordipointlabel.Rd	2012-05-26 05:35:44 UTC (rev 2189)
@@ -12,7 +12,7 @@
 \usage{
 ordipointlabel(x, display = c("sites", "species"), choices = c(1, 2),
    col = c(1, 2),  pch = c("o", "+"), font = c(1, 1), 
-   cex = c(0.8, 0.8), add = FALSE, ...)
+   cex = c(0.8, 0.8), add = FALSE, select, ...)
 }
 
 \arguments{
@@ -24,6 +24,12 @@
      plot. These should be vectors of the same length as the number of
      items in \code{display}.}
   \item{add}{ Add to an existing plot. }
+  \item{select}{Items to be displayed.  This can either be a logical
+    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 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