[R] formula error inside function
Milan Bouchet-Valat
nalimilan at club.fr
Wed Jan 25 10:59:06 CET 2012
Le mardi 24 janvier 2012 à 23:02 -0800, moli a écrit :
> I want use survfit() and basehaz() inside a function, but it doesn't work.
> Could you take a look at this problem. Thanks for your help. Following is my
> codes:
<snip>
> Error in formula.default(object, env = baseenv()) : invalid formula
>
>
> But the following function works:
> coxph(fmla, phmmd)
Please provide us with a shorter code to reproduce the problem. You
can't expect people to read debug the whole function to identify the
problem. You can use traceback() after the error occurs to see where it
comes from.
Also, reproducing the code here doesn't lead to the same error:
Error in model.frame(formula = x, data = phmmd) : object 'x' not found
Cheers
More information about the R-help
mailing list