Skip to content
Prev 337416 / 398500 Next

Survfit error

Certainly the latter, a design mistake that I finally admitted and corrected.  The 
trouble is this usage
      fit <- survfit(Surv(time, status), data=mine)

The data, subset, weights, and na.action arguments are all meant to work with formulas. 
The first argument above isn't a formula.  This left survfit with the quandry of how to 
recognize that the first argument is a "Surv" object and not a formula, and do something 
differently.  Which leads to a stalemate
	a. One doesn't know what type of object the first argument is until it is evaluated
	b. Evaluation will fail, however, unless it is evaluated in the "data=mine" context
	c. The function that does that process (model.frame) expects a formula as its first arg

My program needed to know the answer to a) in order to transform the first arg into a 
formula and correctly execute c), but needed the answer from c) to know if that was necessary.

The old code peeked back at the actual string that was typed by the user, looking for the 
letters "Surv", but was easily fooled.