I can' t see the labels for factor variables in Cox Regression

I am working on the cox regression and survival library in R.
I want to see labels for factor variables in the cox regression output and I can’ t see the labels.
I run this code:

sex<-factor(sex,levels=c(1,2),
labels=c(“man”,“women”))
fit<-coxph(Surv(Time,status)~factor(group)+factor(sex)+age+factor(Diabet), mydata)

What code should I write in R to see label variables?

Thank you

It would be useful to see your full code. From the code you provide, it seems like you are making an object called sex, which is a factor with levels c(1,2) and labels c(“man”, “women”). But in your cox regression, you are using the variable ‘sex’ from the dataset ‘mydata’.

1 Like