Hi,

is there an elegant way to use 'substitute' with '...' arguments?

My first try was this:

 > f1 <- function(...) substitute(...)
 > f1( 2+7, "foo", 3+5 )
2 + 7

As you can see, substitute acts only on the first argument. So I tried

 > f2 <- function(...)  substitute(list(...))
 > f2( 2+7, "foo", 3+5 )
list(2 + 7, "foo", 3 + 5)

This is now all the information I want, but it is not split into the 
individual arguments. I would like to get a character vector, i.e. 
something like
   c( "2 + 7", "\"foo\"", "3 + 5" )

My third try seems to be wrong as well:

 > f3 <- function(...)  lapply( list(...), substitute )
 > f3( 2+7, "foo", 3+5 )
Error in lapply(list(...), substitute) :
   '...' used in an incorrect context

Does anybody has a good hint for me as how to do it correctly?

Thanks
   Simon


+---
| Dr. Simon Anders, Dipl. Phys.
| European Bioinformatics Institute, Hinxton, Cambridgeshire, UK
| preferred (permanent) e-mail: [EMAIL PROTECTED]

______________________________________________
R-help@r-project.org 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.

Reply via email to