diff --git a/.DS_Store b/.DS_Store index 05bd208..028fc6b 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.Rbuildignore b/.Rbuildignore index 50b2d94..1d2a652 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,11 +1,9 @@ ^.*\.Rproj$ ^\.Rproj\.user$ -^data-raw$ + ^_pkgdown\.yml$ ^pkgdown$ ^docs$ -^LICENSE$ -^LICENSES_THIRD_PARTY$ +^LICENSE\.md$ +^LICENSE_THIRD_PARTY\.md$ ^\.github$ -^codecov\.yml$ -^README\.Rmd$ diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..ceeb3fa --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.rtf linguist-generated diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 0000000..2d19fc7 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 0000000..14159b7 --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,50 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +name: R-CMD-check + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: macos-latest, r: 'release'} + - {os: windows-latest, r: 'release'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + + - uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 0000000..a7276e8 --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,48 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + release: + types: [published] + workflow_dispatch: + +name: pkgdown + +jobs: + pkgdown: + runs-on: ubuntu-latest + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::pkgdown, local::. + needs: website + + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} + + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4.5.0 + with: + clean: false + branch: gh-pages + folder: docs diff --git a/.gitignore b/.gitignore index cda2eb7..4eeb251 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,4 @@ .RData .Ruserdata -.DS_Store docs/ -docs diff --git a/DESCRIPTION b/DESCRIPTION index 085a2ff..dc53ce3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: metalite.sl Title: Subject-level Analysis Using 'metalite' Version: 0.1.0 -Authors@R:c( +Authors@R: c( person("Benjamin", "Wang", email = "benjamin.wang@merck.com", role = c("aut", "cre")), person("Yujie", "Zhao", role = "aut"), person("Hiroaki", "Fukuda", role = "aut"), @@ -12,19 +12,19 @@ Description: Provide subject-level analysis. Depends: R (>= 4.1.0) License: GPL (>= 3) Imports: - r2rtf, + glue, metalite, metalite.ae, + r2rtf, reactable, - glue, stringr Suggests: dplyr, + knitr, testthat (>= 3.0.0), - tidyr, - knitr -Encoding: UTF-8 + tidyr VignetteBuilder: knitr +Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 Config/testthat/edition: 3 diff --git a/R/collect.R b/R/collect.R index 87a084c..b557c02 100644 --- a/R/collect.R +++ b/R/collect.R @@ -33,17 +33,17 @@ #' #' @examples #' meta <- meta_sl_example() -#' meta |> -#' collect_baseline( -#' population = "apat", -#' parameter = "age" -#' ) -collect_baseline <- function(meta, - population, - parameter, - type = "Subjects", - use_na = c("ifany", "no", "always"), - display_total = TRUE) { +#' meta |> collect_baseline( +#' population = "apat", +#' parameter = "age" +#' ) +collect_baseline <- function( + meta, + population, + parameter, + type = "Subjects", + use_na = c("ifany", "no", "always"), + display_total = TRUE) { use_na <- match.arg(use_na) title <- c( diff --git a/R/format_base_char.R b/R/format_base_char.R index 5098cac..01015eb 100644 --- a/R/format_base_char.R +++ b/R/format_base_char.R @@ -19,10 +19,12 @@ #' Prepare data for baseline characteristic table #' #' @param outdata A metadata object created by [prepare_base_char()]. -#' @param display_col Column wants to display on the table. Term could be selected from `c("n", "prop", "total")`. +#' @param display_col Column wants to display on the table. +#' The term could be selected from `c("n", "prop", "total")`. #' @param digits_prop Number of digits for proportion columns. #' @param display_stat A vector of statistics term name. -#' The term name could be selected from c("mean", "sd", "se", "median", "q1 to q3", "range", "q1", "q3", "min", "max"). +#' The term name could be selected from +#' `c("mean", "sd", "se", "median", "q1 to q3", "range", "q1", "q3", "min", "max")`. #' #' @return A list of analysis raw datasets. #' @@ -34,10 +36,11 @@ #' meta |> #' prepare_base_char(parameter = "age;gender") |> #' format_base_char() -format_base_char <- function(outdata, - display_col = c("n", "prop", "total"), - digits_prop = 1, - display_stat = c("mean", "sd", "se", "median", "q1 to q3", "range")) { +format_base_char <- function( + outdata, + display_col = c("n", "prop", "total"), + digits_prop = 1, + display_stat = c("mean", "sd", "se", "median", "q1 to q3", "range")) { n_group <- length(outdata$group_label) # Select statistics want to display @@ -56,7 +59,7 @@ format_base_char <- function(outdata, } } - # create output + # Create output tbl <- list() if ("n" %in% display_col) { @@ -109,10 +112,10 @@ format_base_char <- function(outdata, (1 + n_group + ifelse("total" %in% display_col, 1, 0) + 1) )] - rownames(within_tbl) <- NULL outdata$tbl <- within_tbl outdata$display_col <- display_col outdata$display_stat <- display_stat + return(outdata) } diff --git a/R/prepare_base_char.R b/R/prepare_base_char.R index cb2e77b..1edb882 100644 --- a/R/prepare_base_char.R +++ b/R/prepare_base_char.R @@ -34,14 +34,13 @@ #' #' @examples #' meta <- meta_sl_example() -#' -#' meta |> -#' prepare_base_char() -prepare_base_char <- function(meta, - population = "apat", - observation = "wk12", - analysis = "base_char", - parameter = paste(names(meta$parameter), collapse = ";")) { +#' meta |> prepare_base_char() +prepare_base_char <- function( + meta, + population = "apat", + observation = "wk12", + analysis = "base_char", + parameter = paste(names(meta$parameter), collapse = ";")) { parameters <- unlist(strsplit(parameter, ";")) # obtain variables @@ -77,18 +76,18 @@ prepare_base_char <- function(meta, n_pop <- n_pop[, c(length(group) + 2, 1:(length(group) + 1))] n_pop$var_label <- "-----" - # get the baseline characteristics variables in adsl + # Get the baseline characteristics variables in adsl # char_var <- collect_adam_mapping(meta, analysis)$var_name char_var <- do.call(c, lapply(parameters, function(x) { metalite::collect_adam_mapping(meta, x)$var })) - # get the baseline characteristics counts + # Get the baseline characteristics counts char_n <- lapply(parameters, function(x) { collect_baseline(meta, population, x)[[2]] }) - # get the baseline characteristics propositions + # Get the baseline characteristics propositions char_prop <- lapply(parameters, function(x) { collect_baseline(meta, population, x)[[3]] }) diff --git a/R/react_base_char.R b/R/react_base_char.R index ec3e654..ad89630 100644 --- a/R/react_base_char.R +++ b/R/react_base_char.R @@ -18,20 +18,26 @@ #' Display interactive baseline characteristic tables with AE subgroup analysis #' -#' @param metadata_sl A metadata created by [metalite], which builds the baseline characteristic table -#' @param metadata_ae A metadata created by [metalite], which builds the AE subgroup specific table +#' @param metadata_sl A metadata created by [metalite], +#' which builds the baseline characteristic table +#' @param metadata_ae A metadata created by [metalite], +#' which builds the AE subgroup specific table #' @param population A character value of population term name. #' The term name is used as key to link information. #' @param observation A character value of observation term name. #' The term name is used as key to link information. #' @param display_total Display total column or not. -#' @param sl_parameter A character value of parameter term name for the baseline characteristic table. +#' @param sl_parameter A character value of parameter term name for +#' the baseline characteristic table. #' The term name is used as key to link information. -#' @param ae_subgroup A vector of strubf to specify the subgroups in the AE subgroup specific table -#' @param ae_specific A string specifying the AE specific category +#' @param ae_subgroup A vector of strubf to specify the subgroups +#' in the AE subgroup specific table. +#' @param ae_specific A string specifying the AE specific category. #' @param width A numeric value of width of the table in pixels. #' -#' @return An reactable combing both baseline characteristic table and AE subgroup specific tables +#' @return An reactable combing both baseline characteristic table +#' and AE subgroup specific tables. +#' #' @export #' #' @examples @@ -48,15 +54,16 @@ #' width = 1200 #' ) #' } -react_base_char <- function(metadata_sl, - metadata_ae, - population = "apat", - observation = "wk12", - display_total = TRUE, - sl_parameter = "age;gender;race", - ae_subgroup = c("gender", "race"), - ae_specific = "rel", - width = 1200) { +react_base_char <- function( + metadata_sl, + metadata_ae, + population = "apat", + observation = "wk12", + display_total = TRUE, + sl_parameter = "age;gender;race", + ae_subgroup = c("gender", "race"), + ae_specific = "rel", + width = 1200) { # ----------------------------------------- # # total setting # # ----------------------------------------- # diff --git a/R/react_subgroup_table.R b/R/react_subgroup_table.R index 80a9f08..6f01dfe 100644 --- a/R/react_subgroup_table.R +++ b/R/react_subgroup_table.R @@ -18,15 +18,16 @@ #' Create interactive table for a subgroup #' -#' @param tbl Tibble to create reactable -#' @param group Treatment group label -#' @param subgroup_name Subgroup label +#' @param tbl A tibble to create reactable. +#' @param group Treatment group label. +#' @param subgroup_name Subgroup label. #' -#' @return A reactable combing both baseline characteristic table -#' and AE subgroup specific tables for a subgroup -react_subgroup_table <- function(tbl, - group, - subgroup_name) { +#' @return A reactable combining both baseline characteristic table +#' and AE subgroup specific tables for a subgroup. +react_subgroup_table <- function( + tbl, + group, + subgroup_name) { names(tbl) <- tolower(names(tbl)) subgroup_name <- tolower(subgroup_name) race_columns <- grep(tolower(subgroup_name), tolower(names(tbl)), value = TRUE) @@ -80,7 +81,7 @@ react_subgroup_table <- function(tbl, ) } -# Borrow from metalite.ae +# Borrowed from metalite.ae #' Format AE specific analysis #' #' @inheritParams metalite.ae::format_ae_specific diff --git a/R/rtf_base_char.R b/R/rtf_base_char.R index 878d46a..cec9e1f 100644 --- a/R/rtf_base_char.R +++ b/R/rtf_base_char.R @@ -46,16 +46,17 @@ #' path_outdata = tempfile(fileext = ".Rdata"), #' path_outtable = tempfile(fileext = ".rtf") #' ) -rtf_base_char <- function(outdata, - source, - col_rel_width = NULL, - text_font_size = 9, - orientation = "portrait", - footnotes = NULL, - title = NULL, - path_outdata = NULL, - path_outtable = NULL) { - # set default column width +rtf_base_char <- function( + outdata, + source, + col_rel_width = NULL, + text_font_size = 9, + orientation = "portrait", + footnotes = NULL, + title = NULL, + path_outdata = NULL, + path_outtable = NULL) { + # Set default column width tbl <- outdata$tbl display_total <- "total" %in% outdata$display_col if (display_total == TRUE) { @@ -78,7 +79,7 @@ rtf_base_char <- function(outdata, ) } - # set default title + # Set default title if (is.null(title)) { title <- metalite::collect_title(outdata$meta, outdata$population, @@ -88,7 +89,7 @@ rtf_base_char <- function(outdata, ) } - # set default footnote + # Set default footnote footnotes_stat <- NULL if ("numeric" %in% outdata$var_type) { if ("sd" %in% tolower(outdata$display_stat)) { @@ -112,13 +113,13 @@ rtf_base_char <- function(outdata, } } - # set column header + # Set column header colheader <- c( paste0(" | ", paste(group, collapse = " | ")), paste0(" | ", paste(rep("n | (%)", n_group), collapse = " | ")) ) - # set relative width + # Set relative width if (is.null(col_rel_width)) { rel_width_body <- c(3, rep(1, 2 * n_group), 1) } else { @@ -133,7 +134,7 @@ rtf_base_char <- function(outdata, rel_width_head2[-(1:(n_group * 2 + 1))] ) - # column boarder + # Column boarder border_top <- c("", rep("single", n_group * 2)) border_top_body <- c(rep("", n_col - 1), "single") border_bottom <- c(rep("", n_col - 1), "single") @@ -142,13 +143,13 @@ rtf_base_char <- function(outdata, text_format <- c(rep("", 1 + n_group * 2), "b") - # using order number to customize row format + # Using order number to customize row format text_justification <- c("l", rep("c", n_group * 2), "l") text_indent <- matrix(0, nrow = n_row, ncol = n_col) text_indent[, 1] <- ifelse(FALSE, 0, 100) text_indent[1, 1] <- 0 - # use r2rtf + # Use r2rtf outdata$rtf <- tbl |> r2rtf::rtf_page(orientation = orientation) |> r2rtf::rtf_title(title) |> diff --git a/README.md b/README.md index 44eedc0..709f811 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # metalite.sl - +[![R-CMD-check](https://github.com/Merck/metalite.sl/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/Merck/metalite.sl/actions/workflows/R-CMD-check.yaml) ## Overview -The metalite.sl package is an R package designed for the analysis & reporting of subject baseline characteristics in clinical trials. +R package designed for the analysis & reporting of subject baseline characteristics in clinical trials. We assume ADaM datasets are ready for analysis and leverage [metalite](https://merck.github.io/metalite/) data structure to define inputs and outputs. @@ -15,10 +15,10 @@ inputs and outputs. The general workflow is: -1. Define metadata information using metalite R package. -1. `prepare_base_char()` prepares datasets for summary of baseline characteristics. -1. `format_base_char()` formats output layout. -1. `rtf_base_char()` creates TLFs. +1. Define metadata information using metalite. +2. `prepare_base_char()` prepares datasets for summary of baseline characteristics. +3. `format_base_char()` formats output layout. +4. `rtf_base_char()` creates TLFs. Here is a quick example @@ -38,7 +38,9 @@ meta_sl_example() |> path_outtable = tempfile(fileext = ".rtf") ) ``` + ## Highlighted features + - Avoid duplicated input by using metadata structure. - For example, define analysis population once to use in all adverse events analysis. - Consistent input and output in standard functions. diff --git a/_pkgdown.yml b/_pkgdown.yml index d71acfb..02e1d46 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,4 +1,24 @@ -url: ~ +destination: docs + +url: https://merck.github.io/metalite.sl/ + template: bootstrap: 5 + bslib: + preset: "bootstrap" + primary: "#00857c" + navbar-light-brand-color: "#fff" + navbar-light-brand-hover-color: "#fff" + navbar-light-color: "#fff" + navbar-light-hover-color: "#fff" + navbar-light-active-color: "#fff" + dropdown-link-hover-color: "#fff" + dropdown-link-hover-bg: "#00857c" +footer: + structure: + left: [developed_by, built_with, legal] + right: [blank] + components: + legal: "
Copyright © 2024 Merck & Co., Inc., Rahway, NJ, USA and its affiliates. All rights reserved." + blank: "" diff --git a/inst/logo/logo.R b/inst/logo/logo.R index 81b8858..0de46e4 100644 --- a/inst/logo/logo.R +++ b/inst/logo/logo.R @@ -28,4 +28,4 @@ hexSticker::sticker( magick::image_read("man/figures/logo.png") -rstudioapi::restartSession() \ No newline at end of file +rstudioapi::restartSession() diff --git a/man/collect_baseline.Rd b/man/collect_baseline.Rd index bce183b..e7b5ac3 100644 --- a/man/collect_baseline.Rd +++ b/man/collect_baseline.Rd @@ -38,9 +38,8 @@ Count number of subjects } \examples{ meta <- meta_sl_example() -meta |> - collect_baseline( - population = "apat", - parameter = "age" - ) +meta |> collect_baseline( + population = "apat", + parameter = "age" +) } diff --git a/man/format_ae_specific_subgroup.Rd b/man/format_ae_specific_subgroup.Rd index e26d007..1061892 100644 --- a/man/format_ae_specific_subgroup.Rd +++ b/man/format_ae_specific_subgroup.Rd @@ -16,7 +16,7 @@ format_ae_specific_subgroup( ) } \arguments{ -\item{outdata}{A \code{outdata} object created by \code{\link[metalite.ae:prepare_ae_specific]{prepare_ae_specific()}}.} +\item{outdata}{An \code{outdata} object created by \code{\link[metalite.ae:prepare_ae_specific]{prepare_ae_specific()}}.} \item{display}{A character vector of measurement to be displayed. \itemize{ diff --git a/man/format_base_char.Rd b/man/format_base_char.Rd index 0da556c..7e0ff3b 100644 --- a/man/format_base_char.Rd +++ b/man/format_base_char.Rd @@ -14,12 +14,14 @@ format_base_char( \arguments{ \item{outdata}{A metadata object created by \code{\link[=prepare_base_char]{prepare_base_char()}}.} -\item{display_col}{Column wants to display on the table. Term could be selected from \code{c("n", "prop", "total")}.} +\item{display_col}{Column wants to display on the table. +The term could be selected from \code{c("n", "prop", "total")}.} \item{digits_prop}{Number of digits for proportion columns.} \item{display_stat}{A vector of statistics term name. -The term name could be selected from c("mean", "sd", "se", "median", "q1 to q3", "range", "q1", "q3", "min", "max").} +The term name could be selected from +\code{c("mean", "sd", "se", "median", "q1 to q3", "range", "q1", "q3", "min", "max")}.} } \value{ A list of analysis raw datasets. diff --git a/man/prepare_base_char.Rd b/man/prepare_base_char.Rd index d589a66..cacde4c 100644 --- a/man/prepare_base_char.Rd +++ b/man/prepare_base_char.Rd @@ -35,7 +35,5 @@ Prepare data for baseline characteristic table } \examples{ meta <- meta_sl_example() - -meta |> - prepare_base_char() +meta |> prepare_base_char() } diff --git a/man/react_base_char.Rd b/man/react_base_char.Rd index a285d04..693d547 100644 --- a/man/react_base_char.Rd +++ b/man/react_base_char.Rd @@ -17,9 +17,11 @@ react_base_char( ) } \arguments{ -\item{metadata_sl}{A metadata created by \link{metalite}, which builds the baseline characteristic table} +\item{metadata_sl}{A metadata created by \link{metalite}, +which builds the baseline characteristic table} -\item{metadata_ae}{A metadata created by \link{metalite}, which builds the AE subgroup specific table} +\item{metadata_ae}{A metadata created by \link{metalite}, +which builds the AE subgroup specific table} \item{population}{A character value of population term name. The term name is used as key to link information.} @@ -29,17 +31,20 @@ The term name is used as key to link information.} \item{display_total}{Display total column or not.} -\item{sl_parameter}{A character value of parameter term name for the baseline characteristic table. +\item{sl_parameter}{A character value of parameter term name for +the baseline characteristic table. The term name is used as key to link information.} -\item{ae_subgroup}{A vector of strubf to specify the subgroups in the AE subgroup specific table} +\item{ae_subgroup}{A vector of strubf to specify the subgroups +in the AE subgroup specific table.} -\item{ae_specific}{A string specifying the AE specific category} +\item{ae_specific}{A string specifying the AE specific category.} \item{width}{A numeric value of width of the table in pixels.} } \value{ -An reactable combing both baseline characteristic table and AE subgroup specific tables +An reactable combing both baseline characteristic table +and AE subgroup specific tables. } \description{ Display interactive baseline characteristic tables with AE subgroup analysis diff --git a/man/react_subgroup_table.Rd b/man/react_subgroup_table.Rd index 6a84072..2b22fbb 100644 --- a/man/react_subgroup_table.Rd +++ b/man/react_subgroup_table.Rd @@ -7,15 +7,15 @@ react_subgroup_table(tbl, group, subgroup_name) } \arguments{ -\item{tbl}{Tibble to create reactable} +\item{tbl}{A tibble to create reactable.} -\item{group}{Treatment group label} +\item{group}{Treatment group label.} -\item{subgroup_name}{Subgroup label} +\item{subgroup_name}{Subgroup label.} } \value{ -A reactable combing both baseline characteristic table -and AE subgroup specific tables for a subgroup +A reactable combining both baseline characteristic table +and AE subgroup specific tables for a subgroup. } \description{ Create interactive table for a subgroup diff --git a/metalite.sl.Rproj b/metalite.sl.Rproj index 21a4da0..eaa6b81 100644 --- a/metalite.sl.Rproj +++ b/metalite.sl.Rproj @@ -15,3 +15,4 @@ LaTeX: pdfLaTeX BuildType: Package PackageUseDevtools: Yes PackageInstallArgs: --no-multiarch --with-keep.source +PackageRoxygenize: rd,collate,namespace diff --git a/pkgdown/extra.css b/pkgdown/extra.css new file mode 100644 index 0000000..c6b86e3 --- /dev/null +++ b/pkgdown/extra.css @@ -0,0 +1,24 @@ +/* navbar background */ +.bg-light, .navbar-light { + background-color: #00857c !important; +} + +/* navbar version number */ +.nav-text.text-muted { + color: #d9e7e6 !important; +} + +/* navbar link status */ +.navbar-light .navbar-nav .nav-item>.nav-link:hover { + background: #005c55; +} + +.navbar-light .navbar-nav .nav-item.active>.nav-link:hover { + color: #fff; +} + +/* footer */ +footer { + padding-top: 1rem; + padding-bottom: 1rem; +} diff --git a/vignettes/interactive-baseline.Rmd b/vignettes/interactive-baseline.Rmd index 046a91e..dee40e0 100644 --- a/vignettes/interactive-baseline.Rmd +++ b/vignettes/interactive-baseline.Rmd @@ -1,5 +1,5 @@ --- -title: "Build an interactive baseline characteristic table" +title: "Build an Interactive Baseline Characteristic Table" output: rmarkdown::html_document: toc: true @@ -9,10 +9,9 @@ output: code_fold: hide highlight: "textmate" css: "custom.css" -# bibliography: "example.bib" vignette: > %\VignetteEngine{knitr::rmarkdown} - %\VignetteIndexEntry{Build an interactive baseline characteristic table} + %\VignetteIndexEntry{Build an Interactive Baseline Characteristic Table} --- ```{r, message=FALSE} @@ -22,15 +21,17 @@ library(metalite.ae) library(metalite.sl) ``` -There are 2 key metadata: -+ a metadata for the baseline characteristic table -+ a metadata for the AE subgroup specific table +There are 2 key metadata types: + +- metadata for the baseline characteristic table +- metadata for the AE subgroup specific table # Build metadata {.tabset} -## Metadata for baseline characteristic table +## Metadata for baseline characteristic table The code below is the same as `meta_sl_example()`. + ```{r} adsl <- r2rtf::r2rtf_adsl adsl$TRTA <- adsl$TRT01A @@ -86,6 +87,7 @@ meta <- meta_adam( ## A metadata of the AE subgroup specific analysis In this vignette, we will directly use the metadata built by `meta_ae_example()`. + ```{r} meta_ae <- meta_ae_example() ``` @@ -93,6 +95,7 @@ meta_ae <- meta_ae_example() # Build a reactable {.tabset} ## Baseline characteristic table + Participants With Drug-Related AE + ```{r, eval = FALSE} react_base_char( metadata_sl = meta, @@ -103,8 +106,8 @@ react_base_char( ) ``` - ## Baseline characteristic table + Participants With Serious AE + ```{r, eval=FALSE} react_base_char( metadata_sl = meta, diff --git a/vignettes/metalite.sl.Rmd b/vignettes/metalite-sl.Rmd similarity index 93% rename from vignettes/metalite.sl.Rmd rename to vignettes/metalite-sl.Rmd index dfcfc05..fb11288 100644 --- a/vignettes/metalite.sl.Rmd +++ b/vignettes/metalite-sl.Rmd @@ -1,5 +1,5 @@ --- -title: "Quick start" +title: "Getting Started with metalite.sl" output: rmarkdown::html_document: toc: true @@ -8,10 +8,9 @@ output: number_sections: true highlight: "textmate" css: "custom.css" -# bibliography: "example.bib" vignette: > %\VignetteEngine{knitr::rmarkdown} - %\VignetteIndexEntry{What the Vignette Does (Title Case)} + %\VignetteIndexEntry{Getting Started with metalite.sl} --- ```{r} @@ -73,6 +72,7 @@ meta <- meta_adam( ``` # Prepare the numbers + ```{r} outdata <- meta |> prepare_base_char( @@ -83,14 +83,15 @@ outdata <- meta |> ) outdata -# + outdata$n outdata$char_n outdata$char_var outdata$char_prop ``` -# Formate the numbers +# Format the numbers + ```{r} outdata <- outdata |> format_base_char(display_col = c("n", "prop", "total"), digits_prop = 2) @@ -103,7 +104,8 @@ outdata <- outdata |> format_base_char(display_col = c("n", "prop"), digits_prop outdata$tbl ``` -# Output as rtf +# Output as RTF + ```{r} outdata |> rtf_base_char( source = "Source: [CDISCpilot: adam-adsl]", @@ -111,5 +113,3 @@ outdata |> rtf_base_char( path_outtable = tempfile(fileext = ".Rdata") ) ``` - -# References