[R] what can one do with (to) '..." ?

Bert Gunter gunter.berton at gene.com
Tue Aug 16 04:40:35 CEST 2011


FWIW:

1. The best reference i know is the discussion in Venables's and
Ripley's "S Programming" book.

2. VERY BRIEF and INADEQUATE discussion. The general idea is that it
allows one to easily pass down "extra" arguments to the internals of a
function.

For example, suppose that you want to write a function, fitandplot()
that will fit a linear model to data with multiple covariates and then
plot the fitted values versus each of the covariates, but giving the
user the ability to easily change plot options like point color, line
width, etc.. Then instead of having to specify them all (dozens!) in
the top level function as:

fitandplot = function(formula,data, col, lty, pch, cex, etc. etc.)
{
   ## code
   thefit  <- lm( formula, data=data)



On Mon, Aug 15, 2011 at 4:47 PM, Carl Witthoft <carl at witthoft.com> wrote:
> I followed a couple threads from the archives and from stackoverflow.com,
> and would like to know: just what is "..."  ?  What I mean by this is,for
> example, from the point of view of a user running a function in debug mode,
>  is "..." an object, or does it exist in the current environment as some
> thingy?
>
> Maybe a better question to ask is: if I were to write some function that
> accepts "..." for its own personal use, how do I access the optional
> arguments?   Do I simply have to do a series of 'match' or 'pmatch'  on the
> output of list(...) , or is there a more direct way to get at the variables?
>
> If there is a R programmer's manual that discusses this, I'm happy to read
> that, so just let me know.
>
> thanks
> Carl
>
> --
> -----
> Sent from my Cray XK6
>
> ______________________________________________
> 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.
>



-- 
"Men by nature long to get on to the ultimate truths, and will often
be impatient with elementary studies or fight shy of them. If it were
possible to reach the ultimate truths without the elementary studies
usually prefixed to them, these would not be preparatory studies but
superfluous diversions."

-- Maimonides (1135-1204)

Bert Gunter
Genentech Nonclinical Biostatistics
467-7374
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list