Manassa Mauler Manassa Mauler - 1 year ago 60
R Question

Why does the object I usee to store data from a loop throw an error?

nruns <- 100
NLCommand("set N-turtles 100")
for(i in 1:nruns) {
NLDoCommandWhile("count turtles > 99", "go", max.minutes=0)

This code throws an error at the timetaken section saying:

Error in timetaken[[i]] <- NLReport("ticks") :
object 'timetaken' not found

Why is this the case?

Answer Source

The line suggested in the comments works as an answer to my question.

timetaken <- numeric(nruns)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download