0

Long time reader, first time poster.

I was trying different implementation of "substitute()" to get a list of unnamed variable from the ellipsis, when i stumbled upon the application "substitute(...())". It is cleaner than any alternative i tried so far, but i cannot find any documentation for it, or for any other application of "...()". it have the look of a function but (as far as i know) it is not one. I don't know if it safe to use, of if it is a side-effect of the internal working of "substitute"?

I would be glad for any documentation on "...()", too!

sample code:

 myfunction <- function(...){substitute(...())}
 
 variableA <- "Whatever"

 variableB <- "This a Variable"

 variableC <- "Anoter Variable"
 
 results <- myfunction(variableA,
            variableB,
            variableC)
 
 results

[[1]]
variableA

[[2]]
variableB

[[3]]
variableC

 class(results)
[1] "pairlist"

Thanks a lot for your help

zascert
  • 9
  • 2
  • Please don't start questions scripts with `rm(list=ls())`, if others are distracted they will remove everything in their session. This was the subject of a recent [r-devel question](https://stat.ethz.ch/pipermail/r-devel/2022-August/081947.html). The answer is `...()` is not documented. – Rui Barradas Sep 05 '22 at 19:22
  • Possible duplicate of https://stackoverflow.com/questions/70602963/ellipsis-as-function-in-substitute – akrun Sep 05 '22 at 19:36
  • Maybe you can get the result with `match.call()`? – jyr Sep 07 '22 at 13:31
  • Rui: Thanks i will keep that in mind. akrun: Correct, it's a duplicate. i don't know why i didn't find that thread earlier, but i swear i searched for it. jyr: I am not familiar with that function, i will try it and post the result – zascert Sep 08 '22 at 17:13

0 Answers0