[R-sig-Geo] function parameters in overlay()

Agustin Lobo alobolistas at gmail.com
Fri Dec 17 22:04:35 CET 2010


Robert,

How can I define parameters in the functions within overlay() ?
For example:

> fun3 = function(x,y)
{a=-1.1867422
 s=1.0287373
 return((y-(a+s*x))/sqrt(s^2+1))}
> NmaxDev = overlay(bN1999max,bN2009max,fun=fun2,filename="NmaxDev",overwrite=TRUE,format="EHdr",datatype='FLT4S', NAflag=0)

want it to be something like:

> fun3 = function(x,y,a,b)
{return((y-(a+s*x))/sqrt(s^2+1))}
> NmaxDev = overlay(bN1999max,bN2009max,fun=fun2(a=-1.1867422,s=1.0287373),filename="NmaxDev",overwrite=TRUE,format="EHdr",datatype='FLT4S', NAflag=0)

Is it possible or should I redefine the function every time?

Agus



More information about the R-sig-Geo mailing list