The ... (pronounced dot-dot-dot) is a special argument for R functions that captures any arguments to a function that are not otherwise named. It is useful for making functions that can process arbitrary numbers of arguments. One such commonly used function that uses the dot-dot-dot is paste
This can be really cool way to make a function that can process as many objects as you care to through at it (a sequence of model outputs, for example). The way to get hold of the arguments is to turn them into a list, then loop through them.
I had a problem, however, where I wanted to tie two dot-dot-dot functions together. The form is lovely when you are working live in on the R prompt, but how to do it programmatically?
This is often a tangle you can get into wander far enough in to the R jungle. Learning something like dot-dot-dot makes part of your life easier but complicates something else you want to do. I can’t imagine this is something that ever happens to SPSS users but if you are familiar with LISP, it might make you smile.
Anyway, the trick is to use the do.call function, which lets you name a function and then pass it a list of arguments to apply the function to.
So, put those two things together:
-
promrima99 liked this
-
doctrinallif liked this
-
gigglebeachw liked this
-
latexcrazycheerleaders liked this
-
shadyevasion liked this
-
cheerleaderssuperbbw liked this
-
sarcozona liked this
-
differential posted this