Hello all, To set options in a package I'm putting together I'd like to write a function like options, that is: my.options <- function(...) { # ... } Now I'd like to access the named arguments that were passed to my funtion within that function. How does that work? formals() doesn't do it, neither does args() or alist(). How is that done? Thanks, robert
Hello, Inside the function try dots <- list(...) Hope this helps, Rui Barradas Em 09-02-2014 12:14, Robert Latest escreveu:> Hello all, > > To set options in a package I'm putting together I'd like to write a > function like options, that is: > > my.options <- function(...) { > # ... > } > > Now I'd like to access the named arguments that were passed to my > funtion within that function. How does that work? formals() doesn't do > it, neither does args() or alist(). > > How is that done? > > Thanks, > robert > > ______________________________________________ > 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. >
On 09/02/2014 12:14, Robert Latest wrote:> Hello all, > > To set options in a package I'm putting together I'd like to write a > function like options, that is: > > my.options <- function(...) { > # ... > } > > Now I'd like to access the named arguments that were passed to my > funtion within that function. How does that work? formals() doesn't do > it, neither does args() or alist(). > > How is that done?There are lots of examples in the R sources. One common way is dots <- list(...) and match.call() is also used. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595