[R] as.character.call?

Henrik Bengtsson
Wed, 04 Jun 2014 03:13:58 -0000

> cl <- quote(round(10.5))
> deparse(cl)
[1] "round(10.5)"

/Henrik

On Tue, Jun 3, 2014 at 8:07 PM, Spencer Graves
<spencer.graves at structuremonitoring.com> wrote:
>       How can I get a call object as a character string?
>
>
> Example:
>
>> cl <- quote(round(10.5))
>> str(cl)
>  language round(10.5)
>> as.character(cl)
> [1] "round" "10.5"
>
>
>       How can I get "round(10.5)"?
>
>
>        I can get this answer for this toy problem with
> paste0(paste(as.character(cl), collapse='('), ')').
However, that's not a
> general solution.
>
>
>       Thanks,
>       Spencer
>
> ______________________________________________
> 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.