Re: [Rd] standardization of slot access

From: Tony Plate <tplate_at_acm.org>
Date: Tue 26 Sep 2006 - 23:04:53 GMT

I believe that the "accessor" functions you've read about are not the slot() function, rather they are functions specifically designed for extracting certain data from an object. An example is the 'coef()' extractor function, which extracts coefficients from many model objects.   The name of the accessor function need not bear any resemblance to the actual name of the slot in which the data is stored, and indeed, there does not even need to be a one-to-one relationship between accessor functions and slots.

AFAIK, slot() and '@' can be regarded as syntactic variants (please correct me if I'm wrong).

Sebastian P. Luque wrote:
> Hi,
>
> I'm usually confused about when to use 'slot' or '@'. I've frequently
> read that it's always preferable to use accessor functions, so I would
> think the '@' operator should be avoided. However, ?slot contains the
> following advise:
>
>
> "Generally, the only reason to use the functional form rather than the
> simpler operator is _because_ the slot name has to be computed."
>
>
> How do we decide whether to use the function or the operator?
>
>
> Cheers,
>



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed Sep 27 09:06:23 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 27 Sep 2006 - 00:30:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.