[R] Selective Survival Statistics with R

Thomas Lumley tlumley at u.washington.edu
Tue Jun 6 02:04:47 CEST 2006

On Mon, 5 Jun 2006, Gregory Pierce wrote:
> On Mon, 2006-06-05 at 18:54 -0400, Barker, Chris [SCIUS] wrote:
>> Its probably easiest/fastest for you either to subset your dataset
>> first, or else simply use the subset option in survfit()
>>  e.g.
>> survfit( ) has a subset option,
>> survfit( Surv( , ) ~ physician , subset=='Jones")
> Chris,
> Thank you very much for your kind reply. Using subset worked. I had to
> modify the syntax a little from what you posted:
> survfit(Surv(days,status==1)~Physician,subset(viatorr,viatorr[6]=="Pierce")
> where viatorr is the name of my data set.

An example of another approach is given in the example on the help page 
for survfit

You could do
   curves <- survfit(Surv(days,status==1)~Physician, data=viatorr)


Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle

More information about the R-help mailing list