From murdoch.duncan at gmail.com  Fri Jul  9 14:29:57 2010
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Fri, 09 Jul 2010 08:29:57 -0400
Subject: [Rd] Defining a method that behaves like '$'?
In-Reply-To: <4C371398.80603@cbio.uct.ac.za>
References: <4C371398.80603@cbio.uct.ac.za>
Message-ID: <4C371645.6030204@gmail.com>

On 09/07/2010 8:18 AM, Renaud Gaujoux wrote:
> Hi,
>
> is there a way to define a method say '$$' that would behave like '$' 
> and allow calls like 'a$$name'?
No, the parser handles a fixed syntax, and that expression is not 
legal.  You could do it with

a %$$% name

using the infix operator syntax.  (I think the description in the R 
Language Definition suggests this is not legal, since $$ is not a valid 
name, but it does currently work and that's unlikely to change.)

Duncan Murdoch



[Rd] Defining a method that behaves like '$'?
Duncan Murdoch