Try this: > test <- function(x, ...) { + print(x) + dots <- list(...) + if ("y" %in% names(dots)) print(dots$y) + } > test(3, y = 43) [1] 3 [1] 43 > test(4, z = 44) [1] 4 >
On 11/30/06, Carmen Meier <[EMAIL PROTECTED]> wrote: > Hi to all > I did not found the right hints for functions with the dot-dot-dot argument. > Is it possible to write own functions with the tree dots and if yes > what's wrong with the following example? > > > test <- function(x, ...) > { > print (x) > if (exists("y"))print(y) > if (exists("z"))print(z) > } > > test(4,y=2) > > With regards Carmen > > ______________________________________________ > R-help@stat.math.ethz.ch 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. > ______________________________________________ R-help@stat.math.ethz.ch 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.