Re: [R] formula form of coxph

2008-10-02 Thread Yihui Xie
> idx = c(1,3,5) > as.formula(paste("Surv(time, status)~", paste("x", idx, sep = "", collapse = > "+"))) Surv(time, status) ~ x1 + x3 + x5 Regards, Yihui -- Yihui Xie <[EMAIL PROTECTED]> Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 Mobile: +86-15810805877 Homepage: http://www.yihui.name Scho

[R] formula form of coxph

2008-10-02 Thread Xing Yuan
Dear R user, I got a question when using the coxph function. I have 5 covariates x1, x2, x3, x4, x5 and I want to write a function so that when given an indicator, e.g., c(1,3,5), I can fit the model as model=coxph(Surv(time, status)~x1+x3+x5). Any idea to play around the form of formula? Thank y