Sam Ferguson | 1 Sep 01:47

Tables with Graphical Representations

Hi useRs -

I was wondering if anyone out there can tell me where to find R-code  
to do mixes of tables and graphics. I am thinking of something  
similar to this:
http://yost.com/information-design/powerpoint-corrupts/
or like the excel routines people are demonstrating:
http://infosthetics.com/archives/2006/08/excel_in_cell_graphing.html

My aim is to provide small graphics to illustrate numbers directly  
beside or behind their position in the table. Maybe there is a way to  
do it with lattice?

Thanks for any help you may be able to provide.
Sam Ferguson

______________________________________________
R-help <at> stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Frank E Harrell Jr | 1 Sep 16:00

Re: Tables with Graphical Representations

Sam Ferguson wrote:
> Hi useRs -
> 
> I was wondering if anyone out there can tell me where to find R-code  
> to do mixes of tables and graphics. I am thinking of something  
> similar to this:
> http://yost.com/information-design/powerpoint-corrupts/
> or like the excel routines people are demonstrating:
> http://infosthetics.com/archives/2006/08/excel_in_cell_graphing.html
> 
> My aim is to provide small graphics to illustrate numbers directly  
> beside or behind their position in the table. Maybe there is a way to  
> do it with lattice?
> 
> Thanks for any help you may be able to provide.
> Sam Ferguson

The mixtures of tables and graphics we've produced are a bit different 
from the examples you gave but demonstrate the value of combining R and 
LaTeX.  R can produce LaTeX code containing LaTeX picture environments, 
for example.  That's how we put tiny high-resolution histograms inside 
tabular output showing descriptive statistics in the describe function 
and its latex method latex.describe in the Hmisc package.  Charles 
Thomas Dupont is working on a more impressive graphic inside a table by 
adding tiny dot charts showing proportions and confidence limits for 
differences in probabilities to the output produced by the latex method 
for Hmisc's summary.formula function.

An example of the first type may be found in 
http://biostat.mc.vanderbilt.edu/StatGraphCourse under "Mixing Text and 
(Continue reading)

Ted.Harding | 1 Sep 16:56

Re: Tables with Graphical Representations

On 31-Aug-06 Sam Ferguson wrote:
> Hi useRs -
> 
> I was wondering if anyone out there can tell me where to find
> R-code to do mixes of tables and graphics. I am thinking of
> something similar to this:
> http://yost.com/information-design/powerpoint-corrupts/
> or like the excel routines people are demonstrating:
> http://infosthetics.com/archives/2006/08/excel_in_cell_graphing.html
> 
> My aim is to provide small graphics to illustrate numbers directly  
> beside or behind their position in the table. Maybe there is a way
> to do it with lattice?
> 
> Thanks for any help you may be able to provide.
> Sam Ferguson

I dare say there may be a way to do that kind of thing directy within R,
and if so then the graphics experts will no doubt tell us how!

But your examples are just one kind of combined tabular/graphic layout
(and somewhat similar to each other). In a more general context of
combining tables of numerical results with graphic displays, it is
perhaps better to think in terms of using R to produce the numerical
results in the first instance, and then handing these over to software
designed for general-purpose graphical/textual layout. You then have
complete control, and full flexivility of design.

Indeed, in your second (Excel) example, the method of production is
just a nasty kludge -- and it was a happy coincidence that the "REPT"
(Continue reading)

Frank E Harrell Jr | 1 Sep 17:06

Re: Tables with Graphical Representations

(Ted Harding) wrote:
> On 31-Aug-06 Sam Ferguson wrote:
>> Hi useRs -
>>
>> I was wondering if anyone out there can tell me where to find
>> R-code to do mixes of tables and graphics. I am thinking of
>> something similar to this:
>> http://yost.com/information-design/powerpoint-corrupts/
>> or like the excel routines people are demonstrating:
>> http://infosthetics.com/archives/2006/08/excel_in_cell_graphing.html
>>
>> My aim is to provide small graphics to illustrate numbers directly  
>> beside or behind their position in the table. Maybe there is a way
>> to do it with lattice?
>>
>> Thanks for any help you may be able to provide.
>> Sam Ferguson
> 
> I dare say there may be a way to do that kind of thing directy within R,
> and if so then the graphics experts will no doubt tell us how!
> 
> But your examples are just one kind of combined tabular/graphic layout
> (and somewhat similar to each other). In a more general context of
> combining tables of numerical results with graphic displays, it is
> perhaps better to think in terms of using R to produce the numerical
> results in the first instance, and then handing these over to software
> designed for general-purpose graphical/textual layout. You then have
> complete control, and full flexivility of design.
> 
> Indeed, in your second (Excel) example, the method of production is
(Continue reading)

Greg Snow | 1 Sep 18:25

Re: Tables with Graphical Representations

The LaTeX or other solutions suggested are probably best, but here is a
way to do it using only R base graphics (the below code is to get you
started, some graphical parameters need to be set to get the spacing to
look better):

 tmp <- structure(list(Cancer = structure(as.integer(c(19, 23, 22, 13, 
2, 7, 5, 24, 3, 9, 20, 8, 4, 15, 16, 17, 10, 1, 14, 21, 12, 6, 
11, 18)), .Label = c("Brain, nervous system", "Breast", "Cervis, uteri",

"Colon", "Corpus uteri, uterus", "Esophagus", "Hodgkin's Disease", 
"Kidney, renal pelvis", "Larynx", "Leukemia", "Liver, bile duct", 
"Lung and bronchus", "Melanomas", "Multiple myeloma", "Non-Hodgkin's", 
"Oral cavity, pharynx", "Ovary", "Pancreas", "Prostate", "Rectum", 
"Stomach", "Testis", "Thyroid", "Urinary, bladder"), class = "factor"), 
    p5 = c(98.8, 96, 94.7, 89, 86.4, 85.1, 84.3, 82.1, 70.5, 
    68.8, 62.6, 61.8, 61.7, 57.8, 56.7, 55, 42.5, 32, 29.5, 23.8, 
    15, 14.2, 7.5, 4), s5 = c(0.4, 0.8, 1.1, 0.8, 0.4, 1.7, 1, 
    1, 1.6, 2.1, 1.2, 1.3, 0.8, 1, 1.3, 1.3, 1.2, 1.4, 1.6, 1.3, 
    0.4, 1.4, 1.1, 0.5), p10 = c(95.2, 95.8, 94, 86.7, 78.3, 
    79.8, 83.2, 76.2, 64.1, 56.7, 55.2, 54.4, 55.4, 46.3, 44.2, 
    49.3, 32.4, 29.2, 12.7, 19.4, 10.6, 7.9, 5.8, 3), s10 = c(0.9, 
    1.2, 1.3, 1.1, 0.6, 2, 1.3, 1.4, 1.8, 2.5, 1.4, 1.6, 1, 1.2, 
    1.4, 1.6, 1.3, 1.5, 1.5, 1.4, 0.4, 1.3, 1.2, 1.5), p15 = c(87.1, 
    94, 91.1, 83.5, 71.3, 73.8, 80.8, 70.3, 62.8, 45.8, 51.8, 
    49.8, 53.9, 38.3, 37.5, 49.9, 29.7, 27.6, 7, 19, 8.1, 7.7, 
    6.3, 2.7), s15 = c(1.7, 1.6, 1.8, 1.5, 0.7, 2.4, 1.7, 1.9, 
    2.1, 2.8, 1.8, 2, 1.2, 1.4, 1.6, 1.9, 1.5, 1.6, 1.3, 1.7, 
    0.4, 1.6, 1.5, 0.6), p20 = c(81.3, 95.4, 88.2, 82.8, 65, 
    67.1, 79.2, 67.9, 60, 37.8, 49.2, 47.3, 52.3, 34.3, 33, 49.6, 
    26.2, 26.1, 4.8, 14.9, 6.5, 5.4, 7.6, 2.7), s20 = c(3, 2.1, 
(Continue reading)

Anupam Tyagi | 2 Sep 06:26

Re: Tables with Graphical Representations

First Graphic in the initial posting: I think this graphic need to be scaled in
a manner so it can be interpreted correctly while going across rows, columns, and
non-contguous cells, or the correct interpretation and way to read this
provided. For example, in the last row one has to read the numbers to
get the correct information out. I it will be good to have documentation that
explains how to read/interpret this graph, otherwise fixed length boxes are
visually confusing. Anupam.

______________________________________________
R-help <at> stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Ted.Harding | 2 Sep 11:29

Re: Tables with Graphical Representations

On 02-Sep-06 Anupam Tyagi wrote:
> First Graphic in the initial posting: I think this graphic need
> to be scaled in a manner so it can be interpreted correctly while
> going across rows, columns, and non-contguous cells, or the correct
> interpretation and way to read this provided. For example, in the
> last row one has to read the numbers to get the correct information
> out. It will be good to have documentation that explains how to
> read/interpret this graph, otherwise fixed length boxes are
> visually confusing. Anupam.

You are perhaps asking too much from this kind of graphic.

All graphical displays have both merits and limitations. The design
of the display (if it has been thought out) will be chosen so as to
exhibit what the writer wants the reader to see "immediately", along
with "deeper" detail which can be perceived by taking a longer and
closer look but without demanding too dispersed an attention which
can confuse and overload the reader.

In this particular case, one can very quickely see that some 4 cancers
(Prostate-Melanomas) have quite good survival rates over all 4 5-year
periods. For the next four (Breast-Urinary), though survival is good
for the first 5-year period, it can be seen that it is more variable
for subsequent periods. The next 8 (Cervix-Ovary) have a broadly
similar initial survival rate (50%-75%) with subsequent survival
very variable between different cancers. Then there is a somwhat
suddent jump to the final group of eight (Leukemia-Pancreas) where
initial survival (and therefore longer-term survival) is low.

I think the above summary is all that can be directly derived from
(Continue reading)


Gmane