using substitute with multiple parameters

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

using substitute with multiple parameters

Bos, Roger-2
Dear All,

I can't figure out how to pass multiple arguments to substitute to build up a call statement.  One argument works fine:

>    target <- "val1"

>     call <- substitute(select(zidx_df, datadate, target), list(target = as.name(target)))

>     call
select(zidx_df, datadate, val1)

Now I would like to pass multiple arguments to substitute so that I get "select(zidx_df, datadate, val1, val2, val3)", but I only get the first argument:

>     target <- c("val1", "val2", "val3")

>     call <- substitute(select(zidx_df, datadate, target), list(target = as.name(target)))

>     call
select(zidx_df, datadate, val1)

I have tried multiple variations, but none of them are even close, so I won't embarrass myself by posting them here.

Thanks in advance, Roger

***************************************************************

This message is for the named person's use only. It may\...{{dropped:15}}

______________________________________________
[hidden email] 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.