[R] Function objects as arguments of a function

Roger Peng rpeng at stat.ucla.edu
Sat May 25 18:21:01 CEST 2002


Yes!  And it's much more straightforward and clear in R (in my opinion).

-roger
_______________________________
UCLA Department of Statistics
rpeng at stat.ucla.edu
http://www.stat.ucla.edu/~rpeng

On Sat, 25 May 2002, Tsumiyama Isao wrote:

> Hello, R users.
> 
>  In C (or C++) language, a function can be used as
> an argument of another function as follows:
> 
> //  function used as an argument
> void foo(int x)
> {
>     ...
> }
> 
> // function using a function as an argument
> void bar(void (*func)(int ), int arg1, int arg2)
> {
>     ....
> }
> 
> //  The function 'bar' will be called as follows
> int main()
> {
>     ....
> 
>     bar(foo, arg4foo, other_arg);
> 
>     ...
> }
> 
> In R, can function objects be used as arguments of
> a function? 
> 
> Thanks in advance from Japan
> 
> #####################################
> #  Tsumiyama Isao (Mitsubishi Pharma Corp.)
> #  Tel:047-471-7721 
> #  PHS:070-5659-0544
> #  e-mail:tsumi at leo.auric.ne.jp
> #           tsumiyama at pdx.ne.jp(PHS)
> #####################################
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list