Re: [R] Functions returning functions

2009-05-20 Thread Stavros Macrakis
On Wed, May 20, 2009 at 7:21 AM, Paulo Grahl wrote: > A <- function(parameters) { > # calculations w/ parameters returning 'y' > tmpf <- function(x) { # function of 'y' } > return(tmpf) > } > > The value of the parameters are stored in an environment local to the > function. Then I ca

Re: [R] Functions returning functions

2009-05-20 Thread Romain Francois
Romain Francois wrote: Paulo Grahl wrote: Dear All: I have a question regarding the behavior of functions. Say I define a function that returns another function : A <- function(parameters) { # calculations w/ parameters returning 'y' tmpf <- function(x) { # function of 'y' } retu

Re: [R] Functions returning functions

2009-05-20 Thread Gabor Grothendieck
On Wed, May 20, 2009 at 7:48 AM, Wacek Kusnierczyk wrote: > Paulo Grahl wrote: >> Dear All: >> >> I have a question regarding the behavior of functions. >> Say I define a function that returns another function : >> A <- function(parameters) { >>      # calculations w/ parameters returning 'y' >>  

Re: [R] Functions returning functions

2009-05-20 Thread Paulo Grahl
Thanks a lot ! regards, Paulo Gustavo Grahl, CFA On Wed, May 20, 2009 at 8:31 AM, Romain Francois wrote: > Paulo Grahl wrote: >> >> Dear All: >> >> I have a question regarding the behavior of functions. >> Say I define a function that returns another function : >> A <- function(parameters) { >>

Re: [R] Functions returning functions

2009-05-20 Thread Wacek Kusnierczyk
Paulo Grahl wrote: > Dear All: > > I have a question regarding the behavior of functions. > Say I define a function that returns another function : > A <- function(parameters) { > # calculations w/ parameters returning 'y' > tmpf <- function(x) { # function of 'y' } > return(tmpf) >

[R] Functions returning functions

2009-05-20 Thread Paulo Grahl
Dear All: I have a question regarding the behavior of functions. Say I define a function that returns another function : A <- function(parameters) { # calculations w/ parameters returning 'y' tmpf <- function(x) { # function of 'y' } return(tmpf) } The value of the parameters are s