[STATSGRASS] "Neighbourhood modifier" from r.mapcalc in R?

Rainer M Krug Rainer+grass at krugs.de
Tue Oct 16 09:57:59 EDT 2007


Hi

I want to do some map calculations which involve binominal distributed 
random numbers which I can not obtain in r.mapcalc. Therefore I import 
the raster via readRAST6() into R and I want to do the calculations 
there. But I am stuck...

In r.mapcalc I use somthing like

OUTPUT=INPUT1[-2,-2]*INPUT2+INPUT1[+2,+2]*INPUT2

How can I translate this into R?

rA <- readRAST6("INPUT1")
rB <- readRAST6("INPUT2")
but now?

rA$A gives me all cell values,
rA[1:2,1:2]$A gives me the cell values from columns and row 1 and 2,

But I have no idea where I should put the offset in.

Rainer




More information about the grass-stats mailing list