[R-sig-Geo] summing rasters with a condition given by other rasters
Martin Brandt
martin.brandt at mailbox.org
Sun May 17 13:10:20 CEST 2015
There's another issue:
using Ben's great function:
sum_segment <- function(x, ...) {
sum(x[(x[1]+2):(x[2] + 2)],...)
}
what to do if the rasters in the brick contain NA values?
I thought about replacing them with 0:
b <- reclassify(b, cbind(NA, 0))
however, if I want means instead of sums
sum_segment <- function(x, ...) {
mean(x[(x[1]+2):(x[2] + 2)],...)
}
this influences the result.....is there a solution to simply omit pixels
with NAs when the mean or sum in the function are calculated?
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/summing-rasters-with-a-condition-given-by-other-rasters-tp7588222p7588263.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list