[R] alias for a class

cgenolin at u-paris10.fr cgenolin at u-paris10.fr
Fri Mar 14 11:42:37 CET 2008


> Not easily.
Ok

> So you could probably write a function that tracked down and copied 
> all the pieces, but it's not easy.

brrrr. Well, you're right, it's not worth it.

So I will define a class ClusterizLongData then a constructor

cld <- clusterizLongData <- function(){new("ClusterizLongData")}

Christophe

>> With function, we can do
>>
>> mcf <- myCoolFunction <- function(x)....
>>
> That creates a new function which is a copy of the old one.  If one 
> of them changes later, the other won't change, so it's not really an 
> "alias".
>
> The trouble with trying to do this with classes is that a class isn't 
> a simple thing in R.  In S3, it's just a name that can be used in 
> lots of places.  S4 is more structured, but still a class definition 
> is fairly spread out.
>
> So you could probably write a function that tracked down and copied 
> all the pieces, but it's not easy.
>> With class, I define "clusterizedLongData", I want to use it with 
>> the full name when I am writing my code, but I would like something 
>> like cld when I make a demo, or when I try things on console... Is 
>> it possible ?
>
> Isn't it really the job of your text editor to make it easy to type 
> well chosen names?  The GUIs in Windows and on the Mac can do name 
> completion, so you don't need a lot more typing for the long name 
> than the short one.  As far as I know ESS can do the same, and there 
> are probably others too.  If you're not using one of those, you 
> should be.
>
> Duncan Murdoch
>



----------------------------------------------------------------
Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre



More information about the R-help mailing list