pharmaverse / pharmaverse/rtables
`tinytable`
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 260
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
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"))
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the proposed tt.rtables() S3 method and the conversion example in rtables_to_tinytable.R, then compare the proof-of-concept behavior with the existing rtables table-building flow. Done means rtables tables can be converted through tinytable with the demonstrated styling and output support, with the relevant behavior validated in the repository's tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100