-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
Thanks for sharing such an interesting and powerful package!
This is a proof of concept to add support for tinytable, a dependency-free package to draw tables. By implementing a reasonably simple tt.rtables() S3 method, we get:
- Powerful styling functionality (colors, sizes, underlines, rules, bold, italic, etc.)
- Output to HTML (static or interactive w/ filtering, etc), LaTeX, Typst, PNG, markdown (grid and gfm), and (limited) word.
Here's a gist with the code I used:
https://gist.github.com/vincentarelbundock/d81251cea8ed99ffd3f40546b4ab663b
And here is the rendered HTML:
https://arelbundock.com/rtables_examples.html
Here is a simple example:
library(tinytable)
library(rtables)
source("rtables_to_tinytable.R")
lyt1 <- basic_table(
title = "Summary Statistics by Treatment Arm",
main_footer = "Data from clinical trial") %>%
split_cols_by("ARM") %>%
analyze("AGE", function(x) {
in_rows("Mean" = mean(x), "SD" = sd(x), "N" = length(x), .formats = c("xx.x", "xx.x", "xx"))
})
tbl1 <- build_table(lyt1, ex_adsl)
# Convert to tinytable using tt()
tt(tbl1) %>%
style_tt(i = 1, bold = TRUE, color = "white", background = "#2C5F8D", fontsize = 1.3) %>%
style_tt(i = 2:3, background = c("lightgrey", "lightblue"))
shajoezhu
Metadata
Metadata
Assignees
Labels
No labels