I have a raster like this here: https://drive.google.com/drive/u/0/folders/1AEKu4TKpzJg95oXv8dxep24xpXaesr0F
The tif has 11 Layers (timestamps). For each pixel I want to find the timestamp with the maximum value. For some reason one approach works with that data, one does not.
r = rast("au.tif")
terra::app(r, which.max) # works
terra::app(r, function(x){which.max(x)}) # does not work
For the second approach I get this error which I am not really sure about:
Error: Not compatible with requested type: [type=list; target=double].
If I am using another raster, both work. So I was wondering why that might be:
b = rast(system.file("ex/logo.tif", package="terra"))
terra::app(b, which.max) # works
terra::app(b, function(x){which.max(x)}) # works also
Becua