[Rd] Test for argument in ...

From: Gregor Gorjanc <gregor.gorjanc_at_gmail.com>
Date: Sun 02 Jul 2006 - 01:00:33 GMT


Say I have a function foo1, which has argument ... to pass various arguments to foo2 i.e.

foo1 <- function(x, ...)

  foo2(x, ...)

Say that foo2 accepts argument arg1 and I would like to do the following: - if foo1 is called as foo1(x) then I would like to assign some value to arg1 inside foo1 before calling foo2

arg1 <- "some value"
foo2(x, arg1=arg1)


However, I am not able to do this since I do not know how to test/check if arg1 was given in foo1. Is it possible to test whether some argument was passed in "..." i.e. something like

foo1 <- function(x, ...)

  if(testForArgumentInThreeDots(arg1)) arg1 <- "some value"   foo2(x, arg1=arg1, ...)


Lep pozdrav / With regards,
    Gregor Gorjanc

University of Ljubljana     PhD student
Biotechnical Faculty
Zootechnical Department     URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3                   mail: gregor.gorjanc <at> bfro.uni-lj.si

SI-1230 Domzale             tel: +386 (0)1 72 17 861
Slovenia, Europe            fax: +386 (0)1 72 17 888

"One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try." Sophocles ~ 450 B.C.

R-devel@r-project.org mailing list
Received on Sun Jul 02 11:03:04 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 02 Jul 2006 - 02:23:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.