Hi, I'm having some difficulties formulating this question.
But what I want,
is to extract the options associated with a parameter for a function.
e.g.
method = c("Nelder-Mead", "BFGS", "CG",
"L-BFGS-B", "SANN")
in the optim function.
So I would like to have a vector with
c("Nelder-Mead", "BFGS", "CG",
"L-BFGS-B", "SANN")
Or for instance the 'method' in the dist function can be supplied with
euclidian,maximum,manhatten, canberra,binary,minkowski.
Is there someway to extract this so I would have a vector with
c("euclidian","maximum","manhatten",
"canberra","binary","minkowski").
Thanks
Try this: For optim: eval(formals(optim)$method) For dist function: eval(body(dist)[[3]][[3]]) On Mon, Apr 18, 2011 at 10:56 AM, fisken <torpedofisken at gmail.com> wrote:> Hi, I'm having some difficulties formulating this question. > > But what I want, > is to extract the options associated with a parameter for a function. > > e.g. > method = c("Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN") > in the optim function. > > So I would like to have a vector with > c("Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN") > > > Or for instance the 'method' in the dist function can be supplied with > euclidian,maximum,manhatten, canberra,binary,minkowski. > > Is there someway to extract this so I would have a vector with > c("euclidian","maximum","manhatten", "canberra","binary","minkowski"). > > > Thanks > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Henrique Dallazuanna Curitiba-Paran?-Brasil 25? 25' 40" S 49? 16' 22" O
>>> fisken <torpedofisken at gmail.com> 18/04/2011 14:56:56 >>> >But what I want, >is to extract the options associated with a parameter for a function.Try ?formals S Ellison ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}}
thanks 2011/4/18 S Ellison <S.Ellison at lgc.co.uk>:> > >>>> fisken <torpedofisken at gmail.com> 18/04/2011 14:56:56 >>> >>But what I want, >>is to extract the options associated with a parameter for a function. > > Try > ?formals > > S Ellison > > ******************************************************************* > This email and any attachments are confidential. Any u...{{dropped:9}}