>Ah, I think I see what you want. Try this on each pair of exclusive sets:
>
n_total<-dim(mydataset)[1]
under65<-mydataset$age <= 65
n_under65<-sum(under65)
under65row<-c(sum(mydataset$dose[under65] == "FD"),
 sum(mydataset$dose[under65] == "RD"),
 sum(mydataset$vitalstatus[under65] == "dead" &
  mydataset$dose[under65] == "FD"),
 sum(mydataset$vitalstatus[under65] == "dead" &
  mydataset$dose[under65] == "RD"))
over65row<-c(sum(mydataset$dose[!under65] == "FD"),
 sum(mydataset$dose[!under65] == "RD"),
 sum(mydataset$vitalstatus[!under65] == "dead" &
  mydataset$dose[!under65] == "FD"),
 sum(mydataset$vitalstatus[!under65] == "dead" &
  mydataset$dose[!under65] == "RD"))
>
>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.

Thanks Jim.

Yes it looks like that code should do the job.  I was really hoping for a code 
like "SummariseForSubsetAnalysis(mydataset, by=mydatatset$dose, subsets=c(age, 
renal, sex, toxicity), event=survival )" which would magically do it for me ;-)

I guess if this is something I start having to do lots I might have to write 
one.

Surprised one doesn't seem to exist - perhaps the number of variations in what 
people want would be too complex.

Calum


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

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] Summ... Polwart Calum (County Durham and Darlington NHS Foundation Trust)
    • Re:... Viechtbauer Wolfgang (STAT)
    • Re:... Polwart Calum (County Durham and Darlington NHS Foundation Trust)
      • ... Polwart Calum (County Durham and Darlington NHS Foundation Trust)
      • ... Polwart Calum (County Durham and Darlington NHS Foundation Trust)
    • Re:... Polwart Calum (County Durham and Darlington NHS Foundation Trust)

Reply via email to