R Question

Coxph, invalid 'envir' argument of type 'character'

I'm using the Survival package to do a cox regression (coxph) and I can't work out what I'm doing wrong.

My code is

prentice.fit <- coxph(Surv(age_ent, outage, diabetes) ~ a_menopause + cluster(id), data="mydata.cc", ties="breslow")

But I keep getting an error: Error in eval(predvars, data, env) :
invalid 'envir' argument of type 'character'

I have checked the class of all my variables. age_ent and outage are numeric and a_menopause and diabetes are integers.

Would greatly appreciate any help with this!


Answer Source

Value passed to data argument should not be quoted. You are referring to a variable in your environment, not a string.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download