inter.gp.effect <- 0.1
animals <- data.frame(pos = 0:2)
SI.model <- function(Animal.group) {
group <- 1
Animal.group$pos[group] <- Animal.group$pos[group] + 1
effective.animals <- Animal.group$pos # allows us to model inter-group
contact
#
effective.animals[1:(length(Animal.group$pos)-1)] <-
effective.animals[1:(length(Animal.group$pos)-1)] +
inter.gp.effect*Animal.group$pos[2:length(Animal.group$pos)]
##
effective.animals[2:length(Animal.group$pos)] <-
effective.animals[2:length(Animal.group$pos)] +
inter.gp.effect*Animal.group$pos[1:(length(Animal.group$pos)-1)]
return(Animal.group)
}
print(SI.model(animals))
####################################################
results:
source("c:\\r work\\simulation model\\bug.R")
pos
1 1.10
2 1.31
3 2.12
Expected results:
pos
1 1
2 1
3 2