[adegenet-commits] r695 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Oct 19 17:31:18 CEST 2010


Author: jombart
Date: 2010-10-19 17:31:18 +0200 (Tue, 19 Oct 2010)
New Revision: 695

Modified:
   pkg/R/dapc.R
Log:
fixes
again


Modified: pkg/R/dapc.R
===================================================================
--- pkg/R/dapc.R	2010-10-19 15:22:58 UTC (rev 694)
+++ pkg/R/dapc.R	2010-10-19 15:31:18 UTC (rev 695)
@@ -340,7 +340,7 @@
     if(!inherits(x,"dapc")) stop("x is not a dapc object")
 
     ## perform DAPC based on permuted groups
-    lsim <- lapply(1:n.sim, function(i) summary(dapc(x$tab, sample(x$grp), n.pca=n.pca, n.da=n.da))$assign.per.pop)
+    lsim <- lapply(1:n.sim, function(i) summary(dapc(x$tab, sample(x$grp), n.pca=x$n.pca, n.da=x$n.da))$assign.per.pop)
     sumry <- summary(x)
 
     ## get the a-scores
@@ -389,7 +389,8 @@
 
     ## AUXILIARY FUNCTION ##
     f1 <- function(ndim){
-        a.score(x, n.pca=ndim, n.da=n.da, n.sim=n.sim)$pop.score
+        temp <- dapc(x$tab[,1:ndim,drop=FALSE], x$grp, n.pca=ndim, n.da=x$n.da)
+        a.score(temp, n.sim=n.sim)$pop.score
     }
 
 



More information about the adegenet-commits mailing list