From renaud at mancala.cbio.uct.ac.za  Fri Jul  9 14:49:39 2010
From: renaud at mancala.cbio.uct.ac.za (Renaud Gaujoux)
Date: Fri, 09 Jul 2010 14:49:39 +0200
Subject: [Rd] Defining a method that behaves like '$'?
In-Reply-To: <4C371645.6030204@gmail.com>
References: <4C371398.80603@cbio.uct.ac.za> <4C371645.6030204@gmail.com>
Message-ID: <4C371AE3.9060801@cbio.uct.ac.za>

Alright.
Maybe the symbol I chose was not appropriate. I tried ':' to be able to 
do 'a:name' with 'a' a S4 object.
I get the following error:
Error in genericForPrimitive(f) :
   methods may not be defined for primitive function ":" in this version 
of R

Does there exist any symbol that would be suitable for the job?
Thanks

-- 
Renaud Gaujoux
Computational Biology - University of Cape Town
South Africa


On 09/07/2010 14:29, Duncan Murdoch wrote:
> 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

 

###
UNIVERSITY OF CAPE TOWN 

This e-mail is subject to the UCT ICT policies and e-mail disclaimer published on our website at http://www.uct.ac.za/about/policies/emaildisclaimer/ or obtainable from +27 21 650 4500. This e-mail is intended only for the person(s) to whom it is addressed. If the e-mail has reached you in error, please notify the author. If you are not the intended recipient of the e-mail you may not use, disclose, copy, redirect or print the content. If this e-mail is not related to the business of UCT it is sent by the sender in the sender's individual capacity.

###



[Rd] Defining a method that behaves like '$'?
Renaud Gaujoux