I am trying to create a table using the **gtsummary **package in R, with column numbers aligned by the decimal mark. Here’s my code:
library(gtsummary)
library(gt)
theme_gtsummary_journal(journal = "jama")
gt::rx_adsl |>
tbl_summary(
include=c(SEX),
by=TRTA,
digits = all_categorical() ~ c(0, 1),
missing = "no"
)
This code produces the following table:
Code
How can I modify the table so that the numbers in the columns are aligned by the decimal mark?
I tried using gtsummary::modify_table_styling
, but I couldn’t achieve the desired alignment by the decimal mark.
Desired result:
Preview
Thank you.
Alex Zheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.