Open MatthieuStigler opened 7 years ago
Hey @MatthieuStigler ,
you can solve this issue by using
fun=function(x){mean(x, na.rm=TRUE)}
as an argument. For me its working.
Oh thanks Nicolas! But I think the post refers to the extract function, not necessarily the aggregate one?
Hey @MatthieuStigler ,
Coming a bit late I assume, but I am facing the same problem and passing a function, such as fun=function(x){mean(x, na.rm=TRUE)}, doesn't work. An alternative would be to create a raster where NA are replaced by 0. If you work with sf-objects you could simply use: polygon_rasterized <- fasterize::fasterize(sf,raster,f,background=0) then transform into velox object.
Having an na.rm option would also be great for the meanFocal function
It looks like aggregate is not allowing for NAs? It would be great if it were possible to have a
na.rm=TRUE
argument.Thanks!