Re: [R] Extracting values from Surv function in survival package

2024-05-16 Thread CALUM POLWART
I don't think that gives the summary of event numbers without extra work. library(survival) fit <- survfit( Surv(time,status)~sex,data=lung) summary(fit)$n.event [1] 3 1 2 1 1 1 1 2 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 3 1 1 1 1 1 2 [38] 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Re: [R] Extracting values from Surv function in survival package

2024-05-16 Thread Göran Broström
Hi Dennis, look at the help page for summary.survfit, the Value n.event. Göran On 2024-05-15 22:41, Dennis Fisher wrote: OS X R 4.3.3 Colleagues I have created objects using the Surv function in the survival package: FIT.1 Call: survfit(formula = FORMULA1)

Re: [R] Extracting values from Surv function in survival package

2024-05-16 Thread CALUM POLWART
More difficult than it should be IMO. survminer package is often helpful. But if you want to avoid dependency: library(survival) fit <- survfit( Surv(time,status)~sex,data=lung) surfable <-summary(fit)$table surfable # just the events surfable[,"events"] On Wed, 15 May 2024, 21:42 Dennis

[R] Extracting values from Surv function in survival package

2024-05-15 Thread Dennis Fisher
OS X R 4.3.3 Colleagues I have created objects using the Surv function in the survival package: > FIT.1 Call: survfit(formula = FORMULA1) n events median 0.95LCL 0.95UCL SUBDATA$ARM=1, SUBDATA[, EXP.STRAT]=0 18 13345 156 NA SUBDATA$ARM=2,