Claire 'Scotty' Bear Claire 'Scotty' Bear - 4 months ago 38
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 <- coxph(Surv(age_ent, outage, diabetes) ~ a_menopause + cluster(id), data="", 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!



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