From lgautier at gmail.com  Thu Jul  9 17:33:09 2009
From: lgautier at gmail.com (Laurent Gautier)
Date: Thu, 09 Jul 2009 17:33:09 +0200
Subject: [Rd] Suggestion: Dimension-sensitive attributes
In-Reply-To: <19811401A1D8174CB3EAD7F6072E9B50023F3B9D@chsa1025.share.beluni.net>
References: <19811401A1D8174CB3EAD7F6072E9B50023F3B9D@chsa1025.share.beluni.net>
Message-ID: <4A560DB5.3040101@gmail.com>

Bengoechea Bartolom? Enrique (SIES 73) wrote:
> Forgot to answer this one:
> 
>> It would seem natural that metadata associated with one dimension: 
>> would a table-like object

[thanks for reading through what seems much like a telescoped sentences]

> Right. A data frame has the problem that for most use cases one would
> want that each dimension length matches the *rows* of the data frame
> instead of the columns, but it is the columns what we would have "for
> free" when allowing "dimmeta" elements to be lists...

Think of one data.frame per dimension and each data.frame having its 
rows aligned along that dimension.

In the case of a matrix, the dim-1 data.frame would have as many rows as 
rows in the matrix and the dim-2 data.frame would have as many rows as 
columns in the matrix.

When thinking in terms of generalization, one can also note that the 
one-dimension case can already be modelled by a data.frame.


L.

> Enrique
> 
> -----Original Message----- From: Laurent Gautier
> [mailto:lgautier at gmail.com] Sent: jueves, 09 de julio de 2009 14:15 
> Cc: Heinz Tuechler; Bengoechea Bartolom? Enrique (SIES 73); Tony
> Plate; Henrik Bengtsson; r-devel at r-project.org Subject: Re: [Rd]
> Suggestion: Dimension-sensitive attributes
> 
> 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.
> 
>



[Rd] Suggestion: Dimension-sensitive attributes
Laurent Gautier