
Dear list,
I'm trying to apply a function to lists of rasters, but without success.
I'm not sure if it feasible of if I should use a for loop.
Let's say a, b and c are three lists of argument to my function  1/(1-exp(-exp(-((a - b)/c))))  (2 rasters each)
I'd like this function to be applied to these arguments, so that I get as result a list D of 2 rasters, where for example
D[[1]] = 1/(1-exp(-exp(-((A[[1]] - B[[1]])/C[[1]])))) and the same for D[[2]]

I tryed with this but didn't work:

library(raster)

aa<-matrix(c(2,1,3,4),nrow=2,ncol=2)
bb<-matrix(c(5,7,4,6),nrow=2,ncol=2)
cc<-matrix(c(12,13,17,16),nrow=2,ncol=2)
A<-list(raster(aa),raster(t(aa)))
B<-list(raster(bb),raster(t(bb)))
C<-list(raster(cc),raster(t(cc)))

D<-mapply(function(a,b,c) 1/(1-exp(-exp(-((a - b)/c)))), A,B,C)

Any suggestions?

Lorenzo


 		 	   		  
	[[alternative HTML version deleted]]

