0

I'm trying to understand the "..." function within function calls, now I have a function say function(x,...), I though any variables passed to it after x (the ... ) would be used within the function or passed to it's subfunctions?

For e.g my code below. I would expect an output of "fac_ed", "single", class(x) but only class(x) gets outputted, what is wrong?

Code

  set.Class  <- function (x, ...) tryCatch( { class(x)  <- c(..., "class(x)") }, 

                                  error = function(ex) {

                                              class(x)  <- c(..., "query", "data.frame")

                                            } )

set.Class(SMA.grouped,"fac_ed", "single")
uncool
  • 2,613
  • 7
  • 26
  • 55
  • 1
    I don't think this has anything to do with the `...` argument. Did you mean to return `x` from your function? Because otherwise changes to the class will only happen inside the function. – joran Aug 06 '15 at 13:24
  • Yes that is fully correct. Thank you! – uncool Aug 06 '15 at 13:29

0 Answers0