Dear List,

I'm trying to perform some arithmetic operation with layers of a raster
object. What I'm trying is

>require(raster)
>r<- raster(nrows=2, ncols=2)
>r[]<-1:ncell(r)
>s<-stack(r,r)
>names(s)<-c("a","b")

# now I want to add the layers of the raster "r" using their corresponding
names,i.e. "a" and "b" so that I get

>r1<-a+b

I don't want to use subset (or any other methods) to define "a" or "b".
This may be very trivial, but I couldn't do it.

Any suggestions?

Thanks
-- 
Ani

	[[alternative HTML version deleted]]

