How to create a global attribute that is itself an array


I have an array initialized with zeros in a size of 54. I want that in each passage of an entity, one of the cells randomly will grow in one.

What is the best way to do this?

I tried with a global attribute but i dont know what to write instead of "value". What is the array's name??


init<-trajectory("init amount")

add_generator("init", init, at(0),mon=2)


Hi @ereztor! Welcome!

I think it’s going to be hard for helpers to understand your problem without some more information. Can you please try creating a small, self-contained reproducible example that illustrates what you’re trying to do? It’s ok if it doesn’t quite work! But your example should at least include the relevant packages you’re loading and only refer to data that’s available to others. Check out the link for more details on how to do this!

It also might help to explain a little bit more about what you’re doing (I’m guessing writing some sort of simulation??). Experienced R users come from all different backgrounds, so people won’t necessarily automatically understand the goals of your code without some context.