Amen, it should be working. So maybe if you could share the error message
we could better help. If mean() is working, I can't see why sd() wouldn't
work. I tried it with your data and it's working fine.

I suggest you use a smaller raster for your tests so it fails quickly (your
dataset is pretty big).
plot(saf, 1)
e <- drawExtent() # click on two points to draw a window
saf_test <- crop(saf, e)
# ... use saf_test
movi <-  overlay(saf_test, fun=function(x) movingFun(x, fun=mean, n=3,
 na.rm=TRUE))

Etienne


2013/3/19 Amen Alyaari <amen.alyaari@bordeaux.inra.fr>

> Hello,
>
> Now I know where is exactly the problem, it is when I use sd(standard
> deviation) as  a function instead of mean
>
>> movi <-  overlay(stack(saf),fun=**function(x) movingFun(x, fun=mean,
>> n=3,  na.rm=TRUE)) ####  worked well
>>
>     sd <-  overlay(stack(saf),fun=**function(x) movingFun(x, fun=sd, n=3,
>  na.rm=TRUE)) ####  did not work!!!!
>
> Any idea please on how to resolve it because I need both sd and mean
>
> --
> Amen Alyaari, UPMC
> PhD student
> Unit of Functional Ecology&  Environmental Physics [EPHYSE]
> National Institute of Agricultural Research [INRA].
> 71, Avenue Edouard Bourlaux
> 33140 Villenave d'Ornon
> Téléphone : +33(0) 5 57 12 24 27
> Fax : +33 (0)5 57 12 24 20
> FRANCE
>
> ______________________________**_________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/**listinfo/r-sig-geo<https://stat.ethz.ch/mailman/listinfo/r-sig-geo>
>

	[[alternative HTML version deleted]]

