Skip to content
Prev 27780 / 29559 Next

raster: stackApply problems..

Unfortunately the names are not always in ascending order. This is the
result of my data.

names????? : index_4, index_5, index_6, index_7, index_1, index_2, index_3
min values :?????? 3,?????? 3,?????? 3,?????? 3,?????? 3,?????? 3,?????? 3
max values :?? 307.0,?? 297.5,?? 311.0,?? 313.0,?? 468.0,?? 290.0,?? 302.0

And worst of all, it is not a proper match with indices.

If I run it with clusterR then the result is different:

names????? : layer.1, layer.2, layer.3, layer.4, layer.5, layer.6, layer.7
min values :?????? 3,?????? 3,?????? 3,?????? 3,?????? 3,?????? 3,?????? 3
max values :?? 307.0,?? 297.5,?? 311.0,?? 313.0,?? 468.0,?? 290.0,?? 302.0?


The solution is to reorder the layers of the stack so that the
stackApply indices are in ascending order e.g. 1,1,1,2,2,2,3,3,3 ...

My indices of my data was like that:

4 5 6 7 1 2 3 4 5 6 7 1 2 3 5 6 7

I've reported this behavior here
https://github.com/rspatial/raster/issues/82
On 11/20/19 3:05 PM, Ben Tupper wrote: