knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
Any gtsummary table can be placed into a Shiny application.
The trick is that the gtsummary must first be converted into a gt table using the gtsummary::as_gt()
function.
Once the table is a proper gt table, we can use the methods from the gt package to place the table in the Shiny app.
Read more about creating Shiny applications with gt tables here: https://gt.rstudio.com/reference/gt_output.html.
Below is an example of a Shiny app using the gtsummary package to provide dynamic patient characteristic summaries.
```{=html}
If the Shiny app has run out of its free server usage, see below for instructions on running the app locally on your machine. # Shiny Code ```r
To run this Shiny app locally on your machine, save the script above as app.R
in a R Project, open in RStudio, and run the application.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.