diff --git a/R/tableone.R b/R/tableone.R
index 925dd6ae..d1f0885e 100644
--- a/R/tableone.R
+++ b/R/tableone.R
@@ -17,6 +17,23 @@
#' Pre-implemented functions are summarize_long and summarize_short
#' @param ... Pass options to render_table
#'
+#' @section Example Output:
+#' \if{html}{tableone(engine = "gt")}
+#'
+#' \if{html}{\figure{tableone_gt_ex.png}{options: width=65\%}}
+#'
+#' \if{html}{tableone(engine = "DT")}
+#'
+#' \if{html}{\figure{tableone_DT_ex.png}{options: width=65\%}}
+#'
+#' \if{html}{tableone(engine = "kable")}
+#'
+#' \if{html}{\figure{tableone_kable_html_ex.png}{options: width=65\%}}
+#'
+#' \if{html}{tableone(engine = "kable", output_format = "latex")}
+#'
+#' \if{html}{\figure{tableone_kable_latex_ex.png}{options: width=65\%}}
+#'
#' @examples
#'
#' # metadata for table
@@ -25,8 +42,23 @@
#' t1_fn <- "My table one footnote"
#'
#'
+#' ## table by treatment - without overall and render with GT
+#' tbl_gt <-
+#' adtte %>%
+#' dplyr::filter(SAFFL == "Y") %>%
+#' dplyr::select(AGE, AGEGR1, SEX, EVNTDESC, TRTA) %>%
+#' visR::tableone(
+#' strata = "TRTA",
+#' overall = FALSE,
+#' title = t1_title,
+#' datasource = t1_ds,
+#' footnote = t1_fn,
+#' engine = "gt"
+#' )
+#'
#' ## table by treatment - without overall and render with DT
-#' adtte %>%
+#' tbl_DT <-
+#' adtte %>%
#' dplyr::filter(SAFFL == "Y") %>%
#' dplyr::select(AGE, AGEGR1, SEX, EVNTDESC, TRTA) %>%
#' visR::tableone(
@@ -38,21 +70,9 @@
#' engine = "DT"
#' )
#'
-#' ## table by treatment - without overall and render with GT
-#' adtte %>%
-#' dplyr::filter(SAFFL == "Y") %>%
-#' dplyr::select(AGE, AGEGR1, SEX, EVNTDESC, TRTA) %>%
-#' visR::tableone(
-#' strata = "TRTA",
-#' overall = FALSE,
-#' title = t1_title,
-#' datasource = t1_ds,
-#' footnote = t1_fn,
-#' engine = "gt"
-#' )
-#'
#' ## table by treatment - without overall and render with kable
-#' adtte %>%
+#' tbl_kable_html <-
+#' adtte %>%
#' dplyr::filter(SAFFL == "Y") %>%
#' dplyr::select(AGE, AGEGR1, SEX, EVNTDESC, TRTA) %>%
#' visR::tableone(
@@ -66,7 +86,8 @@
#'
#' ## table by treatment - without overall and render with kable as
#' ## a latex table format rather than html
-#' adtte %>%
+#' tbl_kable_latex <-
+#' adtte %>%
#' dplyr::filter(SAFFL == "Y") %>%
#' dplyr::select(AGE, AGEGR1, SEX, EVNTDESC, TRTA) %>%
#' visR::tableone(
diff --git a/README.md b/README.md
index 97d1167a..07402648 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,7 @@ current focus on developing a stable API.
| [![R-CMD-check](https://github.com/openpharma/visR/actions/workflows/check-standard.yaml/badge.svg?branch=main)](https://github.com/openpharma/visR/actions/workflows/check-standard.yaml) | `main` branch |
| [![pkgdown](https://github.com/openpharma/visR/actions/workflows/makedocs.yml/badge.svg)](https://github.com/openpharma/visR/actions/workflows/makedocs.yml) | Documentation building to [Github pages](https://openpharma.github.io/visR/) |
| [![CRAN status](https://www.r-pkg.org/badges/version/visR)](https://CRAN.R-project.org/package=visR) | Latest CRAN release |
-| | `riskmetric` score |
+| | `riskmetric` score |
@@ -117,7 +117,8 @@ covr::package_coverage(
code = "tools::testInstalledPackage(pkg = 'visR', types = c('tests'))",
quiet = FALSE
)
-#> visR Coverage: 99.88%
+#> visR Coverage: 99.64%
+#> R/estimate_cuminc.R: 85.71%
#> R/visr.R: 99.12%
#> R/add_annotation.R: 100.00%
#> R/add_CI.R: 100.00%
@@ -127,7 +128,6 @@ covr::package_coverage(
#> R/add_risktable.R: 100.00%
#> R/apply_attrition.R: 100.00%
#> R/apply_theme.R: 100.00%
-#> R/estimate_cuminc.R: 100.00%
#> R/estimate_KM.R: 100.00%
#> R/get_attrition.R: 100.00%
#> R/get_COX_HR.R: 100.00%
diff --git a/man/figures/tableone_DT_ex.png b/man/figures/tableone_DT_ex.png
new file mode 100644
index 00000000..89eacee3
Binary files /dev/null and b/man/figures/tableone_DT_ex.png differ
diff --git a/man/figures/tableone_gt_ex.png b/man/figures/tableone_gt_ex.png
new file mode 100644
index 00000000..ac2f84f3
Binary files /dev/null and b/man/figures/tableone_gt_ex.png differ
diff --git a/man/figures/tableone_kable_html_ex.png b/man/figures/tableone_kable_html_ex.png
new file mode 100644
index 00000000..bba6d628
Binary files /dev/null and b/man/figures/tableone_kable_html_ex.png differ
diff --git a/man/figures/tableone_kable_latex_ex.png b/man/figures/tableone_kable_latex_ex.png
new file mode 100644
index 00000000..0c73b1cb
Binary files /dev/null and b/man/figures/tableone_kable_latex_ex.png differ
diff --git a/man/tableone.Rd b/man/tableone.Rd
index cff6c21d..d509fbbb 100644
--- a/man/tableone.Rd
+++ b/man/tableone.Rd
@@ -44,6 +44,25 @@ A typical example of a summary table are "table one", the first table in an appl
Calculate summary statistics and present them in a formatted table
}
+\section{Example Output}{
+
+\if{html}{tableone(engine = "gt")}
+
+\if{html}{\figure{tableone_gt_ex.png}{options: width=65\%}}
+
+\if{html}{tableone(engine = "DT")}
+
+\if{html}{\figure{tableone_DT_ex.png}{options: width=65\%}}
+
+\if{html}{tableone(engine = "kable")}
+
+\if{html}{\figure{tableone_kable_html_ex.png}{options: width=65\%}}
+
+\if{html}{tableone(engine = "kable", output_format = "latex")}
+
+\if{html}{\figure{tableone_kable_latex_ex.png}{options: width=65\%}}
+}
+
\examples{
# metadata for table
@@ -52,8 +71,23 @@ t1_ds <- "ADaM Interim Dataset for Time-to-Event Analysis"
t1_fn <- "My table one footnote"
+## table by treatment - without overall and render with GT
+tbl_gt <-
+ adtte \%>\%
+ dplyr::filter(SAFFL == "Y") \%>\%
+ dplyr::select(AGE, AGEGR1, SEX, EVNTDESC, TRTA) \%>\%
+ visR::tableone(
+ strata = "TRTA",
+ overall = FALSE,
+ title = t1_title,
+ datasource = t1_ds,
+ footnote = t1_fn,
+ engine = "gt"
+ )
+
## table by treatment - without overall and render with DT
-adtte \%>\%
+tbl_DT <-
+ adtte \%>\%
dplyr::filter(SAFFL == "Y") \%>\%
dplyr::select(AGE, AGEGR1, SEX, EVNTDESC, TRTA) \%>\%
visR::tableone(
@@ -65,21 +99,9 @@ adtte \%>\%
engine = "DT"
)
-## table by treatment - without overall and render with GT
-adtte \%>\%
- dplyr::filter(SAFFL == "Y") \%>\%
- dplyr::select(AGE, AGEGR1, SEX, EVNTDESC, TRTA) \%>\%
- visR::tableone(
- strata = "TRTA",
- overall = FALSE,
- title = t1_title,
- datasource = t1_ds,
- footnote = t1_fn,
- engine = "gt"
- )
-
## table by treatment - without overall and render with kable
-adtte \%>\%
+tbl_kable_html <-
+ adtte \%>\%
dplyr::filter(SAFFL == "Y") \%>\%
dplyr::select(AGE, AGEGR1, SEX, EVNTDESC, TRTA) \%>\%
visR::tableone(
@@ -93,7 +115,8 @@ adtte \%>\%
## table by treatment - without overall and render with kable as
## a latex table format rather than html
-adtte \%>\%
+tbl_kable_latex <-
+ adtte \%>\%
dplyr::filter(SAFFL == "Y") \%>\%
dplyr::select(AGE, AGEGR1, SEX, EVNTDESC, TRTA) \%>\%
visR::tableone(