[adegenet-commits] r399 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jun 12 14:48:18 CEST 2009


Author: jombart
Date: 2009-06-12 14:48:18 +0200 (Fri, 12 Jun 2009)
New Revision: 399

Modified:
   pkg/R/haploSim.R
Log:
Fix to spatial coords in structured mode.


Modified: pkg/R/haploSim.R
===================================================================
--- pkg/R/haploSim.R	2009-06-12 10:57:55 UTC (rev 398)
+++ pkg/R/haploSim.R	2009-06-12 12:48:18 UTC (rev 399)
@@ -98,7 +98,7 @@
             ##             mvt <- rpois(2*nbLoc, lambda.xy) * sample(c(-1,1), size=2*nbLoc, replace=TRUE)
             ##             res <- t(matrix(mvt, nrow=2) + as.vector(cur.xy))
             idxAncesLoc <- myGrid[cur.xy[1], cur.xy[2]]
-            newLoc <- sample(1:grid.size^2, size=nbLoc, prob=matConnect[,idxAncesLoc]) # get new locations
+            newLoc <- sample(1:grid.size^2, size=nbLoc, prob=matConnect[idxAncesLoc,], replace=TRUE) # get new locations
             res <- cbind(row(myGrid)[newLoc] , col(myGrid)[newLoc]) # get coords of new locations
             return(res)
         }



More information about the adegenet-commits mailing list