尝试在for循环中运行模拟。表示模拟的模型是:
sim.predation(size = 30, n = 100, time = 100, handling.time = 2, draw.plot=FALSE)
我想仅从n
100:1000
变量运行for循环
答案 0 :(得分:0)
sapply(100:1000, function(x){
res <- sim.predation(size = 30, n=x, time = 100, handling.time = 2, draw.plot=FALSE)
return(res)
})
或者:
for (x in 100:1000) {
sim.predation(size = 30, n=x, time = 100, handling.time = 2, draw.plot=FALSE)
}