R/mutation.R

Defines functions `mutation`

`mutation` <-
function(x) {
	n <- length(x)
	mut.type <- sample(3L, 1L)
	mut.pos <- sample(n, 1L)
	x[mut.pos] <- switch(mut.type,
		x[mut.pos] + 1L,
		max(0L, x[mut.pos] - 1L),
		as.integer(runif(1L, 0, x[mut.pos])))
	x
}

Try the ibmpm package in your browser

Any scripts or data that you put into this service are public.

ibmpm documentation built on May 2, 2019, 5:45 p.m.