Message-ID: <20070515181325.GD21178@econ.upenn.edu>
Date: 2007-05-15T18:13:25Z
From: Andrew Clausen
Subject: optim bug (PR#9684)
In-Reply-To: <Pine.LNX.4.64.0705151821490.909@gannet.stats.ox.ac.uk>
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