Skip to content

Instantly share code, notes, and snippets.

@Ram-N
Created March 11, 2013 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ram-N/5136751 to your computer and use it in GitHub Desktop.
Save Ram-N/5136751 to your computer and use it in GitHub Desktop.
simulationOneTrial <- function(start.pop, knumGenerations, trial.index) {
df.allele <- NULL
df.gen <- NULL
#Keep track of the individuals in each generation
df.gen <- rbind(df.gen, start.pop)
x <- start.pop
for ( gen in 1:knumGenerations) {
#print(unlist(nex))
#print(paste("Gen:", gen))
numA <- calcAllelesInGeneration(x)
df.gen <- rbind(df.gen, x)
df.allele <- rbind(df.allele, c(gen, trial.index, numA))
nex <- getNextGen(x)
x <- sample(nex) #shuffle the population for breeding
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment