[adegenet-commits] r269 - in pkg: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Feb 4 19:46:10 CET 2009


Author: jombart
Date: 2009-02-04 19:46:10 +0100 (Wed, 04 Feb 2009)
New Revision: 269

Modified:
   pkg/R/handling.R
   pkg/man/seppop.Rd
Log:
added drop argument to seppop.


Modified: pkg/R/handling.R
===================================================================
--- pkg/R/handling.R	2009-02-04 18:29:27 UTC (rev 268)
+++ pkg/R/handling.R	2009-02-04 18:46:10 UTC (rev 269)
@@ -312,7 +312,7 @@
 setGeneric("seppop", function(x, ...) standardGeneric("seppop"))
 
 ## genind
-setMethod("seppop", signature(x="genind"), function(x,pop=NULL,truenames=TRUE,res.type=c("genind","matrix")){
+setMethod("seppop", signature(x="genind"), function(x,pop=NULL,truenames=TRUE,res.type=c("genind","matrix"), drop=FALSE){
     checkType(x)
 
     ## misc checks
@@ -332,7 +332,7 @@
     ## pop <- x at pop # comment to take pop arg into account
 
     ## make a list of genind objects
-    kObj <- lapply(levels(pop), function(lev) x[pop==lev, ])
+    kObj <- lapply(levels(pop), function(lev) x[pop==lev, , drop=drop])
     names(kObj) <- levels(pop)
 
     ## res is a list of genind

Modified: pkg/man/seppop.Rd
===================================================================
--- pkg/man/seppop.Rd	2009-02-04 18:29:27 UTC (rev 268)
+++ pkg/man/seppop.Rd	2009-02-04 18:46:10 UTC (rev 269)
@@ -15,7 +15,8 @@
   It can also be a matrix of genotypes corresponding to the x\$tab.\cr
 }
 \usage{
-\S4method{seppop}{genind}(x,pop=NULL,truenames=TRUE,res.type=c("genind","matrix"))
+\S4method{seppop}{genind}(x,pop=NULL,truenames=TRUE,res.type=c("genind","matrix"),
+  drop=FALSE)
 }
 \arguments{
   \item{x}{a \linkS4class{genind} object}
@@ -25,8 +26,11 @@
     used (TRUE, default) instead of generic labels (FALSE); used if
     res.type is "matrix".}
   \item{res.type}{a character indicating the type of returned results,
-      a list of \linkS4class{genind} object (default) or a matrix of data
-      corresponding to the 'tab' slots.}
+    a list of \linkS4class{genind} object (default) or a matrix of data
+    corresponding to the 'tab' slots.}
+  \item{drop}{a logical stating whether alleles that are no longer
+  present in a subset of data should be discarded (TRUE) or kept anyway
+  (FALSE, default).}
 }
 \value{
   According to 'rse.type': a list of \linkS4class{genind} object



More information about the adegenet-commits mailing list