[R] multiple return values and optimization

paul sorenson sourceforge at metrak.com
Sat Jun 10 02:34:04 CEST 2006

I have a function (masheff) which returns a value which I can optimize 
no problem, eg:

optimize(masheff, c(15,30), maximum=TRUE, m_gd=5.13, v_tot=41, e_c=1.0)

I would like masheff() to return multiple values say as a list with 
named elements like so:

v = masheff(...)

Is there a simple way to do this in an optimize context or would I need 
to set some global variables and inspect them afterwards?

More information about the R-help mailing list