Open sylviakinosian opened 8 years ago
You are looking in the wrong place. It is not possible to predict, from the code you've given me, what the value of plant.pop is at every timestep. Find that major piece and examine it.
That said, you're probably doing what you did last time. It worked when I simply gave you back what you gave me. If you've been banging your head, take a break and then start over...
On Tue, 15 Nov 2016 at 19:13 sylviakinosian notifications@github.com wrote:
Hi Will,
I'm getting pretty close to having the run.plant.ecosystem function working, but my loops seem not to be very happy. Here's the error that I'm getting:
run.plant.ecosystem(plants, terrain) Error in plant.pop[k, j, i] : incorrect number of dimensions
Somewhere in the nested loops the plant.pop array is being reduced to a single cell - or perhaps just a single variable. Whatever is happening, by the time it gets to calling the survive function plant.pop is not a 3 dimensional array.
loop through time, columns, rows, then adds a timestep
for(i in 1:(dim(plant.pop)[3])){ for(j in 1:(dim(plant.pop)[2])){ for(k in 1:(dim(plant.pop)[1])){ plant.pop <- survive(plant.pop[k,j,i],plants) timestep <- timestep + 1 } }
makes any plants generated in water NA
if(plant.pop[,,i][is.na(terrain)]){ cell <- NA } #breaks the loop after 100 timesteps if(timestep == 100){ break }
}
I've been banging my head against this for about an hour so a hint as to where I'm going wrong would be much appreciated.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pearselab/r-world-sylviakinosian/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/ABLcUvjkt_Jn1fWNBgXXpGBamKJyb3tiks5q-gOhgaJpZM4Ky53_ .
Hi Will,
I'm getting pretty close to having the
run.plant.ecosystem
function working, but my loops seem not to be very happy. Here's the error that I'm getting:Somewhere in the nested loops the
plant.pop
array is being reduced to a single cell - or perhaps just a single variable. Whatever is happening, by the time it gets to calling thesurvive
functionplant.pop
is not a 3 dimensional array.I've been banging my head against this for about an hour so a hint as to where I'm going wrong would be much appreciated.