[adegenet-commits] r509 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Dec 4 15:49:09 CET 2009
Author: jombart
Date: 2009-12-04 15:49:08 +0100 (Fri, 04 Dec 2009)
New Revision: 509
Modified:
pkg/R/dapc.R
Log:
Added a few control of args in dapc.
Modified: pkg/R/dapc.R
===================================================================
--- pkg/R/dapc.R 2009-12-04 12:26:09 UTC (rev 508)
+++ pkg/R/dapc.R 2009-12-04 14:49:08 UTC (rev 509)
@@ -175,6 +175,7 @@
if(!require(ade4, quiet=TRUE)) stop("ade4 library is required.")
if(!require(MASS, quiet=TRUE)) stop("MASS library is required.")
grp <- as.factor(grp)
+ if(length(grp) != nrow(x)) stop("Inconsistent length for grp")
## SOME GENERAL VARIABLES
@@ -214,6 +215,7 @@
n.da <- as.integer(readLines(n = 1))
}
+ n.da <- min(n.da, length(levels(grp))-1) # can't be more than K-1 disc. func.
predX <- predict(ldaX, dimen=n.da)
@@ -247,7 +249,16 @@
+#############
+## dapc.matrix
+#############
+dapc.matrix <- function(x, ...){
+ return(dapc(as.data.frame(x), ...))
+}
+
+
+
#############
## dapc.genind
#############
@@ -279,7 +290,7 @@
## CALL DATA.FRAME METHOD ##
res <- dapc(X, grp=pop.fac, n.pca=n.pca, n.da=n.da,
- center=center, scale=scale, var.contrib=all.contrib)
+ center=FALSE, scale=FALSE, var.contrib=all.contrib)
res$call <- match.call()
@@ -440,7 +451,6 @@
-
###############
## randtest.dapc
###############
More information about the adegenet-commits
mailing list