Displaying 1 result from an estimated 1 matches for "subwrap4".
Did you mean:
subwrap1
2007 Nov 09
2
wrapper for coxph with a subset argument
...t, but none
# seem to do the trick. Is using this argument in a
# program even advisable?
subwrap3 <- function(x, sb) {
coxph(Surv(times,event)~trt, data = x,
subset = eval(substitute(sb), x))
}
subwrap3(testdf, sex == 'F') #does not work
# Using a string, this works, however.
subwrap4 <- function(x, sb) {
coxph(Surv(times,event)~trt, data = x, subset = eval(parse(text=sb)))
}
subwrap4(testdf, "sex == 'F'")
### END R SAMPLE CODE
Thanks so much,
Erik Iverson
iverson at biostat.wisc.edu
> sessionInfo()
R version 2.5.1 (2007-06-27)
i686-pc-linux-gnu...