## Not run:
# # define space:
# minX <- minY <- -3
# maxX <- maxY <- 3
# # 100 individuals randomly placed:
# XY <- cbind(runif(100,minX,maxX),runif(100,minY,maxY))
# # simulate secondary contact by sorting aling the x dimension and assigning parental genotypes on each side of the centerline:
# XY <- XY[order(XY[,1]),]
# Genotypes <- rbind(matrix(0,nrow=sum(XY[,1]<=0),ncol=10),matrix(1,nrow=sum(XY[,1]>0),ncol=10))
# # dispersal and competition parameters:
# sigmad <- 0.3; sigmac <- 0.2; sigmam <- 0.3; R <- 1.75; M <- 5
#
# # selection, inlcuding heterozygote disadvantage at locus 2 and a DM incompatibility between 3 and 4:
# beta <- 0
# sel <- 0
# mid <- 0
# h <- 0.4
# DM <- rbind(
# c(0,0.2,0.4),
# c(0,0.0,0.2),
# c(0,0.0,0.0))
#
# # simulate 10 generations, open to immigration:
# G10 <- spatial.HZ(minX,minY,maxX,maxY,XY,Genotypes,beta,sel,mid,h,DM,sigmad,sigmac,sigmam,R,M,gens=10,immigrants=TRUE)
# ## End(Not run)
Run the code above in your browser using DataLab