[Vegan-commits] r2178 - in pkg/vegan: R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed May 23 17:24:32 CEST 2012
Author: gsimpson
Date: 2012-05-23 17:24:31 +0200 (Wed, 23 May 2012)
New Revision: 2178
Modified:
pkg/vegan/R/ordipointlabel.R
pkg/vegan/inst/ChangeLog
pkg/vegan/man/ordipointlabel.Rd
Log:
add select argument to ordipointlabel
Modified: pkg/vegan/R/ordipointlabel.R
===================================================================
--- pkg/vegan/R/ordipointlabel.R 2012-05-23 07:07:44 UTC (rev 2177)
+++ pkg/vegan/R/ordipointlabel.R 2012-05-23 15:24:31 UTC (rev 2178)
@@ -1,13 +1,28 @@
### 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(isTRUE(all.equal(length(select), NROW(xy[[1]])))) {
+ 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.")
+ }
+ }
if (length(display) > 1) {
col <- rep(col, sapply(xy, nrow))
pch <- rep(pch, sapply(xy, nrow))
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2012-05-23 07:07:44 UTC (rev 2177)
+++ pkg/vegan/inst/ChangeLog 2012-05-23 15:24:31 UTC (rev 2178)
@@ -4,6 +4,11 @@
Version 2.1-16 (opened May 11, 2012)
+ * ordipointlabel: gains argument 'select' which allows some rows
+ of the plotted scores to be skipped in the same manner as for
+ text.cca(). This only applies when a single set of scores is
+ plotted. Otherwise it is ignored and a warning issued.
+
* ordihull, ordiellipse: defaults to use semitransparent fill
colour with 'draw = "polygon"', and gain argument 'alpha' to set
the transparency.
Modified: pkg/vegan/man/ordipointlabel.Rd
===================================================================
--- pkg/vegan/man/ordipointlabel.Rd 2012-05-23 07:07:44 UTC (rev 2177)
+++ pkg/vegan/man/ordipointlabel.Rd 2012-05-23 15:24:31 UTC (rev 2178)
@@ -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,11 @@
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.}
\item{\dots}{Other arguments passed to \code{\link{points}} and
\code{\link{text}}.}
}
More information about the Vegan-commits
mailing list