[R] Using substitute on a function parameter

David Winsemius dwinsemius at comcast.net
Wed Sep 7 23:32:48 CEST 2011


On Sep 7, 2011, at 5:20 PM, Saptarshi Guha wrote:

> Hello,
>
> I would like to write a function where substitute operates on the
> parameter, but ...
>
>
>> Expression =  function(o,l)  substitute(o, l)
>> Expression({x=.(FOO)}, list(FOO=2))
> o
>
> How do i get substitute to work on the contents of o.

I suggest you look at the code of 'bquote'. You seem to be reinventing  
the wheel.

>
> Regards
> Saptarshi
>
> ______________________________________________
> R-help at 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list