Skip to content
Prev 1919 / 398506 Next

Calling survfit within a function

I have a function that generates data and tries to apply the survfit 
within it.  I have tried:

function(..){
x .....
survfit(Surv(tim,sts) ~ grp, data = x, envir = sys.frame(sys.parent()))
}

but I still get "Error: Object "x" not found".  Is there a fix?
(I use R-0.63.2 with the current survival4 package)

Thanks
E. S. Venkatraman
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._