Displaying 1 result from an estimated 1 matches for "newcell".
Did you mean:
newcall
2002 Jun 13
1
A random insertion position in a vector
..., orig))
left <- 1:pos
c(orig[left], new, orig[-left])
}
iterate <-
function(current)
{
## Update the array of cells with a birth followed by a death
parent <- sample(seq(along = current), 1) # index of the parent
pos <- parent - sample(c(0,1), 1)
newcell <- ## generate the new cell based on the type of the parent
newvec <- insert(current, newcell, pos)
newvec[-sample(seq(along = newvec), 1)]
}
Can anyone come up with a cleaner way of doing the insertion or
perhaps the complete birth/death step?
--
Douglas Bates...