[R] Summarising Data for Forrest Plots

Polwart Calum (County Durham and Darlington NHS Foundation Trust) calum.polwart at nhs.net
Fri Jul 31 00:35:37 CEST 2009


>Ah, I think I see what you want. Try this on each pair of exclusive sets:
<snip>

>Then under65row and over65row should be the first two rows of your result.
>Can't test this at the moment, but I don't think it's too far wrong.
>
I knew this shouldn't need so much work ;-)

Not cracked it yet - because as I see it I need a 2 x 4 table and at the moment I only cracked a 2 x 2 table.  ( Or really I need something like a 10 x 4 - but the 4 is the bit that I haven't cracked)

First option is something like this:
with(mydataset,  table(Sex, Dose))

I can get:
        Dose
Sex  FD RD
  F    6    15
  M  16    23

For non catagorical data its slightly trickier... but quite achievable in two lines (for the 2 x 2 table)

factor(cut(mydatasetl$Age, breaks = c(0,65,100))) -> AgeBands
table (AgeBands, mydataset$Dose)

Which gives:

AgeBands  FD RD
 (0,65]        15    6
 (65,100]    13    26

Although - I'm not yet sure if I can actually call that data back by column names.  ie

x <- table (AgeBands, mydataset$Dose)
x$FD

produces an error. :-(

But getting there.














********************************************************************************************************************

This message may contain confidential information. If yo...{{dropped:21}}




More information about the R-help mailing list