[adegenet-commits] r393 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jun 11 13:19:14 CEST 2009
Author: jombart
Date: 2009-06-11 13:19:12 +0200 (Thu, 11 Jun 2009)
New Revision: 393
Modified:
pkg/R/haploSim.R
Log:
Bug fixes.
Modified: pkg/R/haploSim.R
===================================================================
--- pkg/R/haploSim.R 2009-06-10 16:02:10 UTC (rev 392)
+++ pkg/R/haploSim.R 2009-06-11 11:19:12 UTC (rev 393)
@@ -90,10 +90,10 @@
return(res)
}
} else { # use location-dependent lambda param
- xy.dupli <- function(cur.xy){
+ xy.dupli <- function(cur.xy, nbLoc){
lambda.xy <- lambdaMat.xy[cur.xy[1] , cur.xy[2]]
- mvt <- rpois(2, lambda.xy) * sample(c(-1,1), size=2, replace=TRUE)
- res <- cur.xy + mvt
+ 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))
res[res < 1] <- 1
res[res > grid.size] <- grid.size
return(res)
@@ -220,8 +220,8 @@
if(geo.sim){
## some checks
if(!is.null(lambdaMat.xy)) {
- if(nrow(lambdaMax.xy) != ncol(lambdaMat.xy)) stop("lambdaMat.xy is not a square matrix")
- if(nrow(lambdaMax.xy) != grid.size) stop("dimension of lambdaMat.xy does not match grid size")
+ if(nrow(lambdaMat.xy) != ncol(lambdaMat.xy)) stop("lambdaMat.xy is not a square matrix")
+ if(nrow(lambdaMat.xy) != grid.size) stop("dimension of lambdaMat.xy does not match grid size")
}
## initialization
More information about the adegenet-commits
mailing list