Re: [Rd] optim bug (PR#9684)

From: Andrew Clausen <clausen_at_econ.upenn.edu>
Date: Tue, 15 May 2007 14:13:25 -0400

On Tue, May 15, 2007 at 07:02:56PM +0100, Prof Brian Ripley wrote:
> In R you rarely need to pass additional arguments in programming as
> lexical scoping can be used to capture them.

You can also use currying, like this:

	ll <- function(data) function(params)
	{
		# compute whatever you want with data and params.
	}

Then you can call optim like this:

        optim(initial.param, ll(some.data))

Cheers,
Andrew



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue 15 May 2007 - 18:21:09 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 15 May 2007 - 23:33:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.