[Analogue-commits] r323 - in pkg: . R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon May 13 06:56:03 CEST 2013


Author: gsimpson
Date: 2013-05-13 06:56:03 +0200 (Mon, 13 May 2013)
New Revision: 323

Modified:
   pkg/DESCRIPTION
   pkg/R/chooseTaxa.R
   pkg/inst/ChangeLog
   pkg/man/chooseTaxa.Rd
Log:
add 'value' argument

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2013-05-13 04:55:07 UTC (rev 322)
+++ pkg/DESCRIPTION	2013-05-13 04:56:03 UTC (rev 323)
@@ -1,7 +1,7 @@
 Package: analogue
 Type: Package
 Title: Analogue and weighted averaging methods for palaeoecology
-Version: 0.11-2
+Version: 0.11-3
 Date: $Date$
 Depends: R (>= 2.15.0), vegan (>= 1.17-12), princurve, lattice
 Imports: mgcv, MASS, stats, graphics, grid

Modified: pkg/R/chooseTaxa.R
===================================================================
--- pkg/R/chooseTaxa.R	2013-05-13 04:55:07 UTC (rev 322)
+++ pkg/R/chooseTaxa.R	2013-05-13 04:56:03 UTC (rev 323)
@@ -3,7 +3,8 @@
 }
 
 chooseTaxa.default <- function(object, n.occ = 1, max.abun = 0,
-                               type = c("AND","OR"), ...) {
+                               type = c("AND","OR"), value = TRUE,
+                               ...) {
     if(missing(type))
         type <- "AND"
     type <- match.arg(type)
@@ -14,10 +15,14 @@
     } else {
         occ.want | abun.want
     }
-    rname <- rownames(object)
-    cname <- colnames(object)
-    object <- object[, want]
-    rownames(object) <- rname
-    colnames(object) <- cname[want]
-    return(object)
+    if(value) {
+        rname <- rownames(object)
+        cname <- colnames(object)
+        object <- object[, want]
+        rownames(object) <- rname
+        colnames(object) <- cname[want]
+    } else {
+        object <- want
+    }
+    object
 }

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2013-05-13 04:55:07 UTC (rev 322)
+++ pkg/inst/ChangeLog	2013-05-13 04:56:03 UTC (rev 323)
@@ -1,5 +1,11 @@
 analogue Change Log
 
+Version 0.11-3
+
+	* chooseTaxa: new argument `value` controls whether the data for
+	the selected species or a logical vector indicating which columns
+	(species) met the selection criteria.
+
 Version 0.11-2
 
 	* timetrack: plot method now allows plotting of "lc" or "wa"

Modified: pkg/man/chooseTaxa.Rd
===================================================================
--- pkg/man/chooseTaxa.Rd	2013-05-13 04:55:07 UTC (rev 322)
+++ pkg/man/chooseTaxa.Rd	2013-05-13 04:56:03 UTC (rev 323)
@@ -2,7 +2,7 @@
 \alias{chooseTaxa}
 \alias{chooseTaxa.default}
 \title{Select taxa (variables) on basis of maximum abundance attained
-  and number of occurrences}
+  and number of occurrences.}
 \description{
   Select taxa (variables) from an object on the basis of one or both of
   maximum abundance and number of occurrences greater than user-specified
@@ -13,7 +13,7 @@
 chooseTaxa(object, \dots)
 
 \method{chooseTaxa}{default}(object, n.occ = 1, max.abun = 0,
-           type = c("AND","OR"), \dots)
+           type = c("AND","OR"), value = TRUE, \dots)
 }
 %- maybe also 'usage' for other objects documented here.
 \arguments{
@@ -34,13 +34,18 @@
   \item{type}{character; one of \code{"AND"} or \code{"OR"}, controlling
     how the criteria \code{n.occ} and \code{max.abun} are combined to
     generate a subset of the variables in \code{object}.}
+  \item{value}{logical; should the data for the selected taxa be
+    returned? If \code{TRUE}, the default, the data for the chosen taxa
+    are returned. If \code{FALSE}, a logical vector is returned,
+    indicating which taxa met the selection criteria.}
   \item{\dots}{arguments passed on to subsequent methods.}
 }
 %\details{
 %}
 \value{
-  Returns the supplied data frame or matrix with a subset of columns
-  (taxa) that meet the criteria chosen.
+  If \code{value = TRUE},  returns the supplied data frame or matrix
+  with a subset of columns (taxa) that meet the criteria chosen. If
+  \code{value = FALSE}, a logical vector is returned.
 }
 %\references{
 %}
@@ -52,6 +57,9 @@
 IK2 <- chooseTaxa(ImbrieKipp, n.occ = 5)
 dim(ImbrieKipp)
 dim(IK2)
+
+## return a logical vector to select species/columns
+chooseTaxa(ImbrieKipp, n.occ = 5, value = FALSE)
 }
 \keyword{methods}
 \keyword{multivariate}



More information about the Analogue-commits mailing list