[adegenet-commits] r694 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Oct 19 17:22:58 CEST 2010
Author: jombart
Date: 2010-10-19 17:22:58 +0200 (Tue, 19 Oct 2010)
New Revision: 694
Modified:
pkg/R/dapc.R
Log:
corrected a major stupidity in a.score (was not always keeping the same nb of PCs)
Modified: pkg/R/dapc.R
===================================================================
--- pkg/R/dapc.R 2010-10-19 14:15:03 UTC (rev 693)
+++ pkg/R/dapc.R 2010-10-19 15:22:58 UTC (rev 694)
@@ -336,13 +336,11 @@
###############
## a.score
###############
-a.score <- function(x, n.sim=10, n.pca=ncol(x$tab), n.da=length(levels(x$grp)), ...){
+a.score <- function(x, n.sim=10, ...){
if(!inherits(x,"dapc")) stop("x is not a dapc object")
- if(n.pca>ncol(x$tab)) stop("too many PCA axes retained")
- if(n.da>length(levels(x$grp))) stop("too many DA axes retained")
## perform DAPC based on permuted groups
- lsim <- lapply(1:n.sim, function(i) summary(dapc(x$tab[,1:n.pca,drop=FALSE], 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=n.pca, n.da=n.da))$assign.per.pop)
sumry <- summary(x)
## get the a-scores
More information about the adegenet-commits
mailing list