gtsummary live demo — edit and run in your browser
This page runs real R in your browser via WebAssembly — no install, nothing uploaded. Edit the gtsummary code below and press Run Code to rebuild the table on the built-in trial clinical-trial dataset (200 patients).
The first run downloads R plus gtsummary and its dependencies into your browser, so give it 10–30 seconds. After that it’s instant. New to gtsummary? Follow the step-by-step tutorial first, or try the no-code Table 1 explorer.
A grouped Table 1 with a p-value
This is the classic baseline-characteristics table: summarised by treatment, with an automatically chosen test per row. Run it, then try the experiments below.
- Change
by = trttoby = gradeto group by tumour grade instead. - Add
|> add_overall()afteradd_p()for a whole-sample column. - Add
|> bold_labels()to bold the row labels. - Swap
add_p()for nothing to see the plain summary.
Customise the statistics
A second, richer example — relabelled variables, mean (SD) for continuous columns, and a caption. Edit any argument and re-run:
Note the |> as_gt() at the end of each block: it converts the gtsummary table to a gt object, which is what renders as a formatted HTML table in the browser.
This is the same gtsummary we use to produce publication-ready tables on client data. See how we work, or read the step-by-step tutorial.