Skip to content
Prev 33257 / 63424 Next

Suggestion: Dimension-sensitive attributes

Bengoechea Bartolom? Enrique (SIES 73) wrote:
I see. I never faced the issue, but I agree that this can be somehow 
counter-intuitive.
Thinking about it, it seems natural nowadays to consider 
attributes-associated objects as a kind of prototype-based programming 
(and "[" to keep the attributes - although it does somehow consider 
special attributes such as "dim", "names", "dimnames").
In that respect, and as you outline it, this is then like 
"stacking"/"putting side-by-side" arrays of identical dimensions. Your 
time serie data is in one array, the origin of the observation in an 
other...

I would see that as a separate data structure (that could implement the 
metadata interface we are discussing).
I understand the use cases, but I can't stop stop thinking that this 
should be separated from the dimension-associated metadata.

In the examples above, the data structures are two-dimensional and 
therefore dimension-associated metadata will be for "rows" and for 
"columns"; all the cells in a table/array as a sequence are not mapped 
to any *dimension*.
That's what I am thinking.
I bundle "[" with "[<-" to specify that the way indexing is done would 
remain the same (for a second I considered that someone though of 
somehow indexing on the names of the dimensions, or on the metadata).
the colour of the bikeshed
Yes. That the spirit.
I thought about that, but also thought that it could have implications 
on the actual storage of those metadata. In the case the metadata are 
stored in a list, that interface enforces the building of a list.
(I said to ignore implementation for now, but paradoxically this made me 
consider possible implementations).

Let's ignore that and go for consistency first (there will always be 
time to come back on that and make backward compatible changes, such as 
dimmeta(x, i=NULL) # return the list if i is NULL ).
May be good to be trigger-happy for a first pass ( stop("mismatching 
meta data - sorry") )... and mix-and-match use cases might be fewer.
Disabling "dim<-" is, I think, choosing sanity for now.
Same for me (about your comments).
This thread seems to be leading to something great.


L.