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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jul 6 18:24:00 CEST 2011


Author: jombart
Date: 2011-07-06 18:24:00 +0200 (Wed, 06 Jul 2011)
New Revision: 942

Modified:
   pkg/R/dapc.R
   pkg/man/read.genepop.Rd
Log:
Added a comment on haploid data in read.genepop.
Fixed an issue in predict.dapc.


Modified: pkg/R/dapc.R
===================================================================
--- pkg/R/dapc.R	2011-07-05 10:49:05 UTC (rev 941)
+++ pkg/R/dapc.R	2011-07-06 16:24:00 UTC (rev 942)
@@ -348,7 +348,11 @@
     if(pca.info){
         res$pca.loadings <- as.matrix(U)
         res$pca.cent <- glMean(x,alleleAsUnit=FALSE)
-        res$pca.norm <- sqrt(glVar(x,alleleAsUnit=FALSE))
+        if(scale) {
+            res$pca.norm <- sqrt(glVar(x,alleleAsUnit=FALSE))
+        } else {
+            res$pca.norm <- rep(1, nLoc(x))
+        }
         res$pca.eig <- pcaX$eig
     }
 
@@ -955,6 +959,8 @@
     ## HANDLE DIMEN ##
     if(!missing(dimen)){
         if(dimen > object$n.da) stop(paste("Too many dimensions requested. \nOnly", object$n.da, "discriminant functions were saved in DAPC."))
+    } else {
+        dimen <- object$n.da
     }
 
     ## CALL PREDICT.LDA ##

Modified: pkg/man/read.genepop.Rd
===================================================================
--- pkg/man/read.genepop.Rd	2011-07-05 10:49:05 UTC (rev 941)
+++ pkg/man/read.genepop.Rd	2011-07-06 16:24:00 UTC (rev 942)
@@ -5,6 +5,11 @@
 \description{
   The function \code{read.genepop} reads Genepop data files (.gen) and
   convert them into a \linkS4class{genind} object.
+
+  Note: \code{read.genepop} is meant for DIPLOID DATA ONLY. Haploid
+  data with the Genepop format can be read into R using
+  \code{read.table} or \code{read.csv} after removing headers and 'POP'
+  lines, and then converted using \code{\link{df2genind}}.
 }
 \usage{
 read.genepop(file,missing=NA,quiet=FALSE)



More information about the adegenet-commits mailing list