[Rd] Margins on tables

Duncan Murdoch dmurdoch at pair.com
Tue Mar 2 15:13:00 MET 2004


On Tue, 2 Mar 2004 14:20:01 +0100, "BXC (Bendix Carstensen)"
<bxc at 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



More information about the R-devel mailing list