From h.wickham at gmail.com  Sat Feb 16 16:19:29 2013
From: h.wickham at gmail.com (Hadley Wickham)
Date: Sat, 16 Feb 2013 09:19:29 -0600
Subject: [Rd] Printing of anonymous functions in calls is sub-optimal
In-Reply-To: <CACk-te153qhWuzN4MwcozknhM38kNVv6MtJKKg-r1eVx9ODs0w@mail.gmail.com>
References: <CABdHhvEgK1g4gYhmovu_EbvSN185g9LnLAacC5ojWup3_aG07w@mail.gmail.com>
	<CACk-te153qhWuzN4MwcozknhM38kNVv6MtJKKg-r1eVx9ODs0w@mail.gmail.com>
Message-ID: <CABdHhvH4+sm++-wN6mRm9uWY6XTjO5uf7ktWyOFKcB81APeM4g@mail.gmail.com>

On Sat, Feb 16, 2013 at 12:24 AM, Bert Gunter <gunter.berton at gene.com> wrote:
> As there has been no response to this ...
>
> Why not simply:
>
>> g <- substitute(f(x),list(f=function(x){x+1})) ## with curly braces
>> g
> function (x)
> {
>     x + 1
> }(x)
>> x <- 2
>> eval(g)
> [1] 3

Thomas Lumley sent me a similar suggestion off-list; but I'm not
complaining about how it works; my example executed fine. I'm
complaining that the rendering of the call object is misleading.

Hadley


-- 
Chief Scientist, RStudio
http://had.co.nz/



[Rd] Printing of anonymous functions in calls is sub-optimal
Hadley Wickham