I'm hoping I'm missing some (probably fundamental basic process) which might 
make my life easier!

Lets assume I have a 3 column table summarizing results from a trial from three 
arms (Arm A, B and C).
For each arm there will be a number of pieces of information to report.  The 
simplest example might be to compare this to the demographic comparisons often 
seen in clinical traisl where you are setting out to prove that your 
randomization produced similar populations

So I might have a table like this:

---------------------------------------
                 A             B               C
---------------------------------------

Male            50              50              50
Female  49              51              50

Age < 65        30              29              31
Age 65+ 69              72              69
---------------------------------------

I've got a matrix with that data in it which I'm passing to odfWeave's table 
function.   I just want to check a few basic things.

Here's some short code which will create the matrix:
groups = c("A","B","C")
factors = c("Male","Female", "Age &lt; 65", "Age 65+")
mydata = matrix (c(50,49,30,69,50,51,29,72,50,50,31,69), nrow=4, dimnames = 
list(factors,groups))

- Is there anyway to add a merged cell above ABC which would say Group?
- If I want to total column I can do that using:
total=as.numeric()
for (fact in 1:length(factors)) {
        total[fact]=sum(mydata[fact,])
}
mydata = cbind(mydata,total)
Is there an easier way?

- Now lets say i want to do a chi-squ test between the ages differences in Gp A 
and Gp B I run
chisq.test(mydata[3:4,1:2])
What I really want is the p-value and I'll want to repeat that for Gp A vs Gp 
C.  If I was just using R I'd simply print those and then add them to my table 
by hand.  But I'm trying to be smart and use odfWeave.  Now I know I can put 
them in my caption but I'd probably have added them as an extra row in my table 
or added it in brackets similar to the SDs/ORs and CIs shown in this example 
http://www.bmj.com/cgi/content-nw/full/340/feb05_1/c199/TBL2 depending which 
was more appropriate.

- Is there an easy way to do anything like this?  I'm thinking that we often 
put crude numbers in and (%) in brackets, or CIs etc  - so my exported table 
would not ideally be pure numbers.

- As a p value usually links two columns I might have expected to use a merged 
cell which again brings me back to my original question ;-)

Thanks





Calum Polwart BSc(Hons) MSc MRPharmS SP IP
Network Pharmacist - North of England Cancer Network and
Pharmacy Clinical Team Manager (Cancer & Aseptic Services) - County Durham & 
Darlington NHS Foundation Trust

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

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

______________________________________________
R-help@r-project.org 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.
  • [R] odfW... Polwart Calum (County Durham and Darlington NHS Foundation Trust)

Reply via email to