Nested for
loop
I already talk about single for
loop in a previous post. The same way
we did for
loop for a single object, we can do it multiple times.
Here a short example: First import the data from here
Status mark Stand_ID.m pattern_state 1: living NA 1 state1 2: living DBH 1 state2 3: dead dead 1 state1 4: dead mortality 1 state1 5: living NA 2 state3 --- 188: living DBH 38 state2 189: dead dead 38 state1 190: dead mortality 38 state3 191: living NA 39 state1 192: living DBH 39 state1
And then we can try a nested loop like this:
summary | summary | |
---|---|---|
living | 0 | 5 |
dead | 32 | 23 |
And here are the results. I know that we can do it in a simpler way,
it was just here as an example and before presenting you the foreach
loop which are used to do parallel computing.