[adegenet-commits] r164 - in pkg: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Aug 11 17:18:38 CEST 2008


Author: jombart
Date: 2008-08-11 17:18:38 +0200 (Mon, 11 Aug 2008)
New Revision: 164

Modified:
   pkg/R/chooseCN.R
   pkg/man/chooseCN.Rd
Log:
fixed the jitter in chooseCN


Modified: pkg/R/chooseCN.R
===================================================================
--- pkg/R/chooseCN.R	2008-08-04 17:12:06 UTC (rev 163)
+++ pkg/R/chooseCN.R	2008-08-11 15:18:38 UTC (rev 164)
@@ -15,16 +15,7 @@
   d1.first <- d1
   d2.first <- d2
   k.first <- k
-  
-  ## check for uniqueness of coordinates
-  x <- xy[,1]
-  y <- xy[,2]
-  temp <- table(x,y)
-  if(any(temp>1) & (!is.null(type) && type!=7)){ # coords need not be unique if type==7 (inverse distances)
-    xy <- jitter(xy)
-    warning("Random noise was added to xy as duplicated coordinates existed.")
-  }
-  
+
   ## handle type argument
   if(!is.null(type)){
       type <- as.integer(type)
@@ -32,6 +23,16 @@
       ask <- FALSE
   }
 
+  ## check for uniqueness of coordinates
+  x <- xy[,1]
+  y <- xy[,2]
+  temp <- table(x,y)
+  if(any(temp>1) & (!is.null(type) && !type %in% c(5,7))){ # coords need not be unique if type==5 or 7
+      xy <- jitter(xy)
+      warning("Random noise was added to xy as duplicated coordinates existed.")
+  }
+
+  
   if(is.null(type) & !ask) { type <- 1 }
   
   ### begin large while ###

Modified: pkg/man/chooseCN.Rd
===================================================================
--- pkg/man/chooseCN.Rd	2008-08-04 17:12:06 UTC (rev 163)
+++ pkg/man/chooseCN.Rd	2008-08-11 15:18:38 UTC (rev 164)
@@ -4,9 +4,10 @@
 \title{Function to choose a connection network}
 \description{The function \code{chooseCN} is a simple interface to
   build a connection network (CN) from xy coordinates. The user chooses
-  from 6 types of graph. \code{chooseCN} calls functions from
-  appropriate packages, handles non-unique coordinates and returns a
-  connection network either with classe \code{nb} or \code{listw}.  
+  from 6 types of graph and one additional weighting scheme.
+  \code{chooseCN} calls functions from appropriate packages, handles
+  non-unique coordinates and returns a connection network either with
+  classe \code{nb} or \code{listw}.
 }
 \usage{
 chooseCN(xy, ask = TRUE, type = NULL, result.type = "nb", d1 = NULL, 



More information about the adegenet-commits mailing list