R-beta: ?faq example of scoping

Robert Gentleman rgentlem at stat.auckland.ac.nz
Wed Aug 6 22:21:01 CEST 1997


 I like Thomas' example. Kurt can you include it in the FAQ. 
 
 Recently I have been doing a lot of programming that has required either
 optimization or zero-finding. Unfortunately most of the functions need
 some arguments to be optimized over and have other parameters that depend on
 the data but are fixed with respect to optimization. With R scoping rules
 this is a trivial problem; simply make up the function with the required
 definitions in the same environment and scoping takes care of it. With
 Splus my solution has been to add an extra parameter to the function and
 to the optimizer to pass in these extras. That's fine for optimizers I 
 write myself but it doesn't work for the builtin ones. Fortunately I haven't
 yet found a one-d problem that some thought and bisection won't take care
 of.
 
 robert
 
 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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