[R] How to get function arguments as list?
Prof Brian Ripley
ripley at stats.ox.ac.uk
Sun Feb 9 13:35:12 CET 2014
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
More information about the R-help
mailing list