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

**URL:** <https://discourse.datamethods.org/t/i-can-t-see-the-labels-for-factor-variables-in-cox-regression/4100>\
**Category:** data analysis\
**Tags:** survival-analysis, r\
**Created:** [February 1, 2021, 12:27pm UTC](https://discourse.datamethods.org/t/i-can-t-see-the-labels-for-factor-variables-in-cox-regression/4100 "2021-02-01T12:27:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cgdm](https://discourse.datamethods.org/letter_avatar_proxy/v4/letter/c/c4cdca/32.png) [@Cgdm](https://discourse.datamethods.org/u/Cgdm)\
**Post date:** [February 1, 2021, 12:27pm UTC](https://discourse.datamethods.org/t/i-can-t-see-the-labels-for-factor-variables-in-cox-regression/4100/1 "2021-02-01T12:27:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![VLysne](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/vlysne/32/1195_2.png) [@VLysne](https://discourse.datamethods.org/u/VLysne)\
**Post date:** [February 1, 2021, 2:12pm UTC](https://discourse.datamethods.org/t/i-can-t-see-the-labels-for-factor-variables-in-cox-regression/4100/2 "2021-02-01T14:12:14Z")

</div>

> [@Cgdm](#):
>
> ant to see labels for factor variables in the cox regression output and I can’ t see the labels.  
> I run this code:

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’.
