From maechler at stat.math.ethz.ch  Sat Aug  9 19:57:27 2008
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Sat, 9 Aug 2008 19:57:27 +0200
Subject: [Rd] matrix name
In-Reply-To: <489DC701.9090602@altk.com>
References: <489DC701.9090602@altk.com>
Message-ID: <18589.55943.265674.509774@cmath-5.math.ethz.ch>

>>>>> Vincent Nijs <mel at altk.com>
>>>>>     on Sat, 09 Aug 2008 18:34:09 +0200 writes:

    >>> Hello,
    >>> Presently, we are able to add additionnal info to a matrix
    >>> thanks to the nice comment() and attr() functions.
    >>> Maybe I miss some other functions ?

    >>> Since there is a always a little remaining place on the
    >>> top left when one print a matrix,
    >>> I was wondering if it won't be interesting to offer the
    >>> possibility to show some information here,

    >>> I'm thinking on something like :

    >> attr(M, 'topleft') = 'city\prms';
    >> M
    >>> city\prms      a    b    c
    >>> seattle        1    3    5
    >>> vancouver      2    4    6

Well,  dimnames  can be named :

  > matrix(1:6, 2,3, dimnames=list(rows=c("r1","r2"), cols=c("A","B","C")))
      cols
  rows A B C
    r1 1 3 5
    r2 2 4 6

This implements (something better I think than)  what you want.
The *printing* though is slightly different (since more
flexible).

Martin 

    >>> I don't know if it's easily feasible and even if it seems
    >>> interesting enough ... so sorry if it is a silly idea.

    >>> All the best
    >>> Vincent



[Rd] matrix name
Martin Maechler