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-max51-8952-8956-8851-88
Missing0 (0%)0 (0%)0 (0%)0 (0%)
SEX
F143 (56.3%)53 (61.6%)40 (47.6%)50 (59.5%)
M111 (43.7%)33 (38.4%)44 (52.4%)34 (40.5%)
TRTA
Placebo86 (33.9%)NANANA
Xanomeline High Dose84 (33.1%)NANANA
Xanomeline Low Dose84 (33.1%)NANANA
Data Source: ADaM Interim Dataset for Time-to-Event Analysis
-
+ ## Cite visR diff --git a/man/figures/README-tableone_print-1.png b/man/figures/README-tableone_print-1.png new file mode 100644 index 00000000..a0807794 Binary files /dev/null and b/man/figures/README-tableone_print-1.png differ