Thanks, deparse(substitute()) does exactly what I want.

On Sat, Mar 24, 2012 at 4:20 PM, R. Michael Weylandt
<michael.weyla...@gmail.com> wrote:
> Can you be a little more concrete?
>
> If you want the form of the expression given (rather than its value),
> deparse(substitute()) will work:
>
> fnc1 <- function(x){ deparse(substitute(x))}
>
> fnc1(3) # 3
>
> fnc1(x) # "x"
>
> fnc1(x + 4) # "x+4"
>
> If you are passing them through the ... argument, you can coerce that
> to a list and use the names() attribute.
>
> If you want to reconstruct the exact call (e.g., for a modelling
> function), match.call() will do it.
>
> Hope this helps,
> Michael
>

______________________________________________
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