Starting by working on an interface for such object(s) is probably the first step toward a unified solution, and this before about if and how R attributes are used.

It would also help to ensure a smooth transition from the existing classes implementing a similar solution (first the interface is added to those classes, then after a grace period the classes are eventually refactored).

Dimension-level is what seems to the be most needed... but I am not convinced of the practicality of the object-level, and cell-level scheme s proposed:

- Object-level, if not linked to any dimension-attribute is such saying that one want to attach anything to any object. That's what attr() is already doing.

- Cell-level, is may be out-of-scope for one first trial (but may be I missed the use-cases for it)



If starting with behaviour, it seems to boil to having "["/"[<-" and "dimmeta()"/"dimmeta<-()", :

- extract "[" / replace "[<-" :

  * keeps working the way it already does

* extracts a subset of the object as well as a subset of the dimension-associated metadata.

* departing too much from the way "[" is working and add behind-the-curtain name matching will only compromise the chances of adoption.

* forget about the bit about which metadata is kept and which one isn't when using "[". Make a function "unmeta()" (similar behavior to "unname()") to drop them all, or work it out with something like
> dimmeta(x, 1) <- NULL # drop the metadata associated with dimension 1

- access the dimension-associated metadata:

* may be a function called "dimmeta()" (for consistency with "dimnames()") ? The signature could be dimmeta(x, i), with x the object, and i the dimension requested. A replace function "dimmeta<-"(x, i, value) would be provided.


In the abstract the "names" associated with a given dimension is just one of possible metadata, but I'd keep away from meddling with it for a start.


It would seem natural that metadata associated with one dimension:
would a table-like object (data.frame seems natural in R, and unfortunately there is no data.frame-like structure in R).



L.

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to