[adegenet-commits] r689 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Oct 18 16:50:03 CEST 2010


Author: jombart
Date: 2010-10-18 16:50:03 +0200 (Mon, 18 Oct 2010)
New Revision: 689

Modified:
   pkg/R/dapc.R
Log:
rounding up nb of selected PCs


Modified: pkg/R/dapc.R
===================================================================
--- pkg/R/dapc.R	2010-10-18 14:46:41 UTC (rev 688)
+++ pkg/R/dapc.R	2010-10-18 14:50:03 UTC (rev 689)
@@ -60,6 +60,7 @@
     n.pca <- min(X.rank, n.pca)
     if(n.pca >= N) stop("number of retained PCs of PCA is greater than N")
     if(n.pca > N/3) warning("number of retained PCs of PCA may be too large (> N /3)\n results may be unstable ")
+    n.pca <- round(n.pca)
 
     U <- pcaX$c1[, 1:n.pca, drop=FALSE] # principal axes
     XU <- pcaX$li[, 1:n.pca, drop=FALSE] # principal components
@@ -77,6 +78,7 @@
     }
 
     n.da <- min(n.da, length(levels(grp))-1, n.pca) # can't be more than K-1 disc. func., or more than n.pca
+    n.da <- round(n.da)
     predX <- predict(ldaX, dimen=n.da)
 
 



More information about the adegenet-commits mailing list