I'm running a pretty simple cox model from the `survminer` package.

```
surv_object <- Surv(time, event)
model <- coxph(surv_object ~ female + age + ethnicity + imd, data = df)

```

I need to run multiple Cox models, and for each model, my predictors change. I have all my predictors stored in a separate data frame such as this (we'll call it `pred_df`):

```
> pred_df    

# A tibble: 4 x 2
       predictor    endpoint 
       <chr>        <chr>    
     1 female       Mortality
     2 age          Mortality
     3 ethnicity    Mortality
     4 imd          Mortality

```

Is there an easy way to pass the items from the `predictor` column to `coxph()`? Something like this:

```
coxph(surv_object ~ predictors, data = df)

```

---

**What I've tried already:**

I've tried a rather clumsy hack along these lines:

```
pred_vars <- pred_df %>% 
     pull(predictor) %>%                 # extract column values as a vector
     paste(collapse = " + ") %>%         # combine values in a string
     parse(text = . )                    # parse the string as an expression

model <- coxph(surv_object ~ eval(pred_vars), data = df)

```

R actually understands this and runs the model. But the output is uninterpretable. The model seems to run but does not output individual predictors i.e. `female`, `age`, `ethnicity` and `imd`. Instead it just outputs `eval(pred_vars)`

```
Call:
coxph(formula = Surv(time, event) ~ eval(pred_vars), data = df)

  n= 62976, number of events= 12882 
   (3287 observations deleted due to missingness)

                     coef exp(coef)  se(coef)     z Pr(>|z|)    
eval(pred_vars) 3.336e-05 1.000e+00 5.339e-06 6.249 4.14e-10 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

                exp(coef) exp(-coef) lower .95 upper .95
eval(pred_vars)         1          1         1         1

Concordance= 0.515  (se = 0.003 )
Rsquare= 0.001   (max possible= 0.989 )
Likelihood ratio test= 38.28  on 1 df,   p=6e-10
Wald test            = 39.04  on 1 df,   p=4e-10
Score (logrank) test = 39.07  on 1 df,   p=4e-10

```

There must be a simpler way of doing this?