require(raster)
## Function to aggregate
fun.patch <- function(x) {
if (max(table(x)) >= 0.9 * length(x)) {
return(as.vector(which.max(table(x))))
}
else
return(NA)
}
r.lc <- raster(nrows = 100, ncols = 100)
r.lc[] <- 1:6
aggregate(r.lc, fact = c(5,5), fun.patch)
Error in FUN(newX[, i], ...) : unused argument(s) (na.rm = TRUE)
?raster::aggregate
. The function you pass should accept or ignore ana.rm
argument. – mnel