diff --git a/README.Rmd b/README.Rmd index 276d2fcc..8c0a1d7c 100644 --- a/README.Rmd +++ b/README.Rmd @@ -110,9 +110,10 @@ adtte %>% The `tableone()` function presents summary statistics in a table format. -```{r table, warning=FALSE, message = FALSE} +```{r tableone, warning=FALSE, message = FALSE} ## table by treatment - without overall and render with GT -adtte %>% +tableone <- + adtte %>% dplyr::select(AGE, SEX, TRTA) %>% visR::tableone( strata = "TRTA", @@ -123,6 +124,20 @@ adtte %>% ) ``` +```{r tableone_print, include = FALSE} +# Had to manually save images in temp file, not sure if better way. +gt::gtsave(tableone, file = file.path(tempdir(), "temp.png")) +``` + +```{r out.width = "90%", echo = FALSE} +# Have to do this workaround since the README needs markdown format for GitHub page but a different format for the website. +if (identical(Sys.getenv("IN_PKGDOWN"), "true")) { + table1 # display true html table +} else { + # show saved image + knitr::include_graphics("man/figures/README-tableone_print-1.png") +} +``` ## Cite visR diff --git a/README.md b/README.md index 200278f2..6a5709ed 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ coverage](https://codecov.io/gh/openpharma/visR/branch/develop/graph/badge.svg)] [![pkgdown](https://github.com/openpharma/visR/actions/workflows/makedocs.yml/badge.svg)](https://github.com/openpharma/visR/actions/workflows/makedocs.yml) [![CRAN status](https://www.r-pkg.org/badges/version/visR)](https://CRAN.R-project.org/package=visR) - + ## Installation @@ -105,7 +105,8 @@ The `tableone()` function presents summary statistics in a table format. ``` r ## table by treatment - without overall and render with GT -adtte %>% +tableone <- + adtte %>% dplyr::select(AGE, SEX, TRTA) %>% visR::tableone( strata = "TRTA", @@ -116,501 +117,7 @@ adtte %>% ) ``` -
Cohort Summary | -||||
---|---|---|---|---|
- | Total (N=254) | -Placebo (N=86) | -Xanomeline High Dose (N=84) | -Xanomeline Low Dose (N=84) | -
AGE | -||||
Mean (SD) | -75.1 (8.25) | -75.2 (8.59) | -74.4 (7.89) | -75.7 (8.29) |
Median (IQR) | -77 (70-81) | -76 (69.2-81.8) | -76 (70.8-80) | -77.5 (71-82) |
Min-max | -51-89 | -52-89 | -56-88 | -51-88 |
Missing | -0 (0%) | -0 (0%) | -0 (0%) | -0 (0%) |
SEX | -||||
F | -143 (56.3%) | -53 (61.6%) | -40 (47.6%) | -50 (59.5%) |
M | -111 (43.7%) | -33 (38.4%) | -44 (52.4%) | -34 (40.5%) |
TRTA | -||||
Placebo | -86 (33.9%) | -NA | -NA | -NA |
Xanomeline High Dose | -84 (33.1%) | -NA | -NA | -NA |
Xanomeline Low Dose | -84 (33.1%) | -NA | -NA | -NA |
Data Source: ADaM Interim Dataset for Time-to-Event Analysis | -||||
- |