[adegenet-commits] r475 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Nov 12 12:26:44 CET 2009


Author: jombart
Date: 2009-11-12 12:26:43 +0100 (Thu, 12 Nov 2009)
New Revision: 475

Modified:
   pkg/R/haploPop.R
Log:
Root can be added when computing distances.


Modified: pkg/R/haploPop.R
===================================================================
--- pkg/R/haploPop.R	2009-11-12 11:21:00 UTC (rev 474)
+++ pkg/R/haploPop.R	2009-11-12 11:26:43 UTC (rev 475)
@@ -267,11 +267,16 @@
 ###############
 ## dist.haploPop
 ###############
-dist.haploPop <- function(x){
+dist.haploPop <- function(x, add.root=TRUE){
     if(!inherits(x, "haploPop")) stop("x is not a haploPop object")
 
     x <- unlist(x, recursive=FALSE)
-    ## x <- as.array(x)
+
+    ## handle root
+    if(add.root){ # add the root
+       x <- c(list(), x)
+    }
+
     n <- length(x)
 
     f1 <- function(a,b){



More information about the adegenet-commits mailing list