Java Mailing List Archive

http://www.r-help.com/

Home » R Help for Statistical Computing »

Re: [R] Passing expression as argument to do.call

Duncan Murdoch

2009-07-02

Replies: Find Java Web Hosting

Author LoginPost Reply
On 7/2/2009 4:34 PM, Sebastien Bihorel wrote:
> Dear R-users,
>
> I would like to know how expressions could be passed as arguments to
> do.call functions. As illustrated in the short example below,
> concatenating lists objects and an expression creates an expression
> object, which is not an acceptable argument for do.call. Is there a way
> to avoid that?

Put the expression in a list. See below...

>
> Thanks you
>
> Sebastien
>
>
> foo <- list(x=1:10, y=1:10)
> mylist <- list(pch=6, col=2)
> title <- "1 microgram"
> title2 <- expression ("1 " mu "g")

Needs *'s or paste, i.e.

title2 <- expression ("1 " * mu * "g")

>
> do.call(plot, c(foo, mylist, main=title))

do.call(plot, c(foo, mylist, list(main=title)))

Duncan Murdoch

>
> class(c(foo, mylist, main=title2))
>
> do.call(plot, c(foo, mylist, main=title2))
>
> ______________________________________________
> R-help@(protected)
> 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.

______________________________________________
R-help@(protected)
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.
©2008 r-help.com - Jax Systems, LLC, U.S.A.