Description Usage Arguments Value Examples
rtMoveReflectNoGo
moves proportion of popn in each cell to the 4 neighbouring cells.
Movers are divided equally between the 4 cardinal neighbours.
If any of the neighboring cells are no-go areas the flies that would have moved there
stay in their current cell. Thus movement to the other neighbouring cells will not be increased in this time step.
But it will be increased in following time steps because the neighbouring cells will receive a proportion of the flies
that didn't move to the nogo area in the preceeding timestep.
This could represent flies turning back from an unpleasant area in one timestep and then trying other directions later.
Boundaries are reflecting.
This function works on a single age class, it can be made to work on multiple age classes
by passing an array[y,x,age] to aaply(.margins=3)
Doesn't try to cope with nrow or ncol==1.
1 2 3 |
m |
a matrix of cells containing a single number representing one age |
mNog |
a matrix of cells of 0&1, 0 for nogo areas |
pMove |
proportion of popn that moves out of the cell. |
verbose |
print what it's doing T/F |
an updated matrix following movement
1 2 3 4 5 6 7 8 | #1 nogo neighbour
rtMoveReflectNoGo(m = array(c(0,0,0,0,1,0,0,0,0,0,0,0),dim=c(3,4)), mNog = array(c(1,0,1,1,1,1,1,1,1,1,1,1),dim=c(3,4)), verbose=TRUE)
#2 nogo neighbours
rtMoveReflectNoGo(m = array(c(0,0,0,0,1,0,0,0,0,0,0,0),dim=c(3,4)), mNog = array(c(1,0,1,0,1,1,1,1,1,1,1,1),dim=c(3,4)), verbose=TRUE)
#3 nogo neighbours
rtMoveReflectNoGo(m = array(c(0,0,0,0,1,0,0,0,0,0,0,0),dim=c(3,4)), mNog = array(c(1,0,1,0,1,0,1,1,1,1,1,1),dim=c(3,4)), verbose=TRUE)
#4 nogo neighbours, all flies stay
rtMoveReflectNoGo(m = array(c(0,0,0,0,1,0,0,0,0,0,0,0),dim=c(3,4)), mNog = array(c(1,0,1,0,1,0,1,0,1,1,1,1),dim=c(3,4)), verbose=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.