Enrico gave you a workaround that stores the extra values in an environment.
Another possible workaround is an optional argument to myfun() that asks
it to return more information, e.g.
fr <- function(x, data, extraInfo = FALSE) { ## Rosenbrock Banana
function
x1 <- x[1]
On Thu, 03 Aug 2023, Sami Tuomivaara writes:
> Dear all,
>
> I have used optim a lot in contexts where it would
> useful to be able to iterate function myfun that, in
> addition to the primary objective to be minimized
> ('minimize.me'), could return other values such as
> alternative metrics of t