[R] Formula parsing and updating
Johannes Huesing
johannes at huesing.name
Sat Dec 6 06:41:58 CET 2008
Charles C. Berry <cberry at tajo.ucsd.edu> [Fri, Dec 05, 2008 at 01:21:41AM CET]:
> On Thu, 4 Dec 2008, Johannes Huesing wrote:
>>> somemod$formula
>> Surv(lebzeit, tot == 1) ~ sex + (alter >= 65) + diff3k + zelltyp_k_c +
>> q_nuc_3k + kar_k80_g80 + stadium
>
> You need to give us something to reproduce. I get an error when I try
>
>> example(coxph)
>> test1$quant <- rnorm(length(test1$sex))
>> fit <- coxph( Surv(time, status) ~ x + (quant>0) + strata(sex), test1)
> Error in model.matrix.default(newTerms, m) :
> model frame and formula mismatch in model.matrix()
Odd, since I had no problem entering the formula in this naive way.
> When I protect with I(quant>0), I have no problems obtaining 'fit' nor
> update()ing it:
I was unaware of I(), and this did the trick for me. Thank you!
--
Johannes Hüsing There is something fascinating about science.
One gets such wholesale returns of conjecture
mailto:johannes at huesing.name from such a trifling investment of fact.
http://derwisch.wikidot.com (Mark Twain, "Life on the Mississippi")
More information about the R-help
mailing list