Displaying 1 result from an estimated 1 matches for "numreal".
Did you mean:
numeral
2004 Nov 22
0
IFELSE across a 3D array?
...***************
library(abind)
#Sim: 0=Absent; 1=Present; 10=NODATA
vectSim <-
c(0,1,0,1,10,0,1,0,1,1,10,0,1,1,0,1,0,10,10,1,0,1,0,1,0,1,1,10,0,10,10,1,0,1,0,10)
#Mask: 1=DATA; 10=NODATA
vectMask <- c(10,1,10,1,1,10,1,10,1,10,10,1)
length(vectSim)
length(vectMask)
numRow<-3
numCol<-4
numReal<-3
Sim <- array(vectSim, c(numRow,numCol,numReal))
Sim
Mask <- array(vectMask, c(numRow,numCol))
Mask
SmoothSim <- apply(Sim, c(1,2), ifelse(MaskSim==10,33,99))
SmoothSim
********************
Any help is much appreciated!
Thanks,
Sander and Alessandro.