Skip to content

IFELSE across large array?

1 message · Ray Brownrigg

#
The original message mentions that the value 10 is actually "NODATA",
and if one recodes 10 as NA, steps a) to c) become trivial, namely:

A[A == 10] <- NA
M[M == 10] <- NA
return(A + M - 1)

Then if step d) is performed first (i.e. appropriate values in A are
replaced by the 'most common neighbour' [perhaps using
round(mean(.., na.rm=T))] this still works, but would have to be repeated
for each replication (the third dimension).

Ray Brownrigg