From dmurdoch at pair.com  Tue Mar  2 15:13:00 2004
From: dmurdoch at pair.com (Duncan Murdoch)
Date: Tue Mar  2 15:13:00 2004
Subject: [Rd] Margins on tables
In-Reply-To: <0ABD88905D18E347874E0FB71C0B29E90179DE5F@exdkba022.novo.dk>
References: <0ABD88905D18E347874E0FB71C0B29E90179DE5F@exdkba022.novo.dk>
Message-ID: <bu4940dih5omfqfpjhj0t7crdmindggq0g@4ax.com>

On Tue, 2 Mar 2004 14:20:01 +0100, "BXC (Bendix Carstensen)"
<bxc@steno.dk> wrote :

>It has long been a nuisance to me not being able to form margins on
>multiway tables in a simple fashion, so i wrote margins().
>
>In my opinion it should go into the base package. The code and the
>documentation is in:
>
>http://www.biostat.ku.dk/~bxc/R/margins/
>
>Please help yourself, and enhance and rename as you see fit.

I really like the idea of this (and in fact was planning to work on
something similar, when I had time).

A couple of comments:

It would be nice if the label for the added margin matched the name of
the function, even when "FUN=fun" was used instead of "FUN =
list(name=fun)".

It might be nice to be able to add some lines to the tables (though
this is more of an ftable request than a margins request, the
modifications will probably have to be done together).  So for example
the table 

          Sea Black Dead Red White Min Max
Aye  Bee                                  
Oui  Buzz         3    7   9     6   3   9
     Hum         12   10   8     7   7  12
Si   Buzz        10    9   7     9   7  10
     Hum          5    9   3     6   3   9
Yes  Buzz         0   10   5     5   0  10
     Hum         12    8   9     8   8  12
Sum  Buzz        13   26  21    20  13  26
     Hum         29   27  20    21  20  29

could be displayed as

          Sea | Black Dead Red White | Min Max
Aye  Bee      |                      |        
----------------------------------------------
Oui  Buzz     |     3    7   9     6 |   3   9
     Hum      |    12   10   8     7 |   7  12
Si   Buzz     |    10    9   7     9 |   7  10
     Hum      |     5    9   3     6 |   3   9
Yes  Buzz     |     0   10   5     5 |   0  10
     Hum      |    12    8   9     8 |   8  12
----------------------------------------------   
Sum  Buzz     |    13   26  21    20 |  13  26
     Hum      |    29   27  20    21 |  20  29

(Fixed pitch fonts required!)

Duncan


[Rd] Margins on tables
Duncan Murdoch