Is there a way to change "_" in referent category in the gtsummary to "Ref" or any other string?

Viewed 104

I have tried to change the "_" to "Ref" but I cannot get my head around it. Changing the "-" too may be 1 would be nice. The desired output is https://www.dropbox.com/scl/fi/9bmrggkdtoegkmbad1bmz/gtsummaryreference.docx?dl=0&rlkey=608mna8aqn0zcjoeh6iest08b

---
title: "Regression Model"
author: "Moses Otieno"
date: "31/03/2021"
output: word_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE)
```

```{r, include=FALSE}
library(gtsummary)

```

```{r }
m1 <- glm(response ~ age + stage, trial, family = binomial)

tbl_regression(m1, exponentiate = TRUE) 

```
1 Answers

The link with the desired output does not work for me. But here's an example how the em-dashes can be modified.

library(gtsummary)
#> #Uighur
packageVersion("gtsummary")
#> [1] '1.4.0'

m1 <- 
  glm(response ~ age + stage, trial, family = binomial) %>%
  tbl_regression(
    exponentiate = TRUE,
    add_estimate_to_reference_rows = TRUE  # this adds 1 to the coef row
  ) %>%
  # this will update the em-dash in the CI row to Ref.
  modify_table_styling(
    columns = ci,
    rows = reference_row %in% TRUE,
    missing_symbol = "Ref."
  )

enter image description here Created on 2021-04-23 by the reprex package (v2.0.0)

Related