Package 'metalite.sl'

Title: Subject-Level Analysis Using 'metalite'
Description: Analyzes subject-level data in clinical trials using the 'metalite' data structure. The package simplifies the workflow to create production-ready tables, listings, and figures discussed in the subject-level analysis chapters of "R for Clinical Study Reports and Submission" by Zhang et al. (2022) <https://r4csr.org/>.
Authors: Benjamin Wang [aut, cre], Yujie Zhao [aut], Hiroaki Fukuda [aut], PoYao Niu [aut], Nan Xiao [aut], Jeetener Chauhan [ctb], Li Ma [ctb], Chen Wang [ctb], Merck Sharp & Dohme Corp [cph]
Maintainer: Benjamin Wang <[email protected]>
License: GPL (>= 3)
Version: 0.1.0
Built: 2024-12-23 13:41:02 UTC
Source: CRAN

Help Index


Count number of subjects

Description

Count number of subjects

Usage

collect_baseline(
  meta,
  population,
  parameter,
  type = "Subjects",
  use_na = c("ifany", "no", "always"),
  display_total = TRUE
)

Arguments

meta

A metadata object created by metalite.

population

A character value of population term name. The term name is used as key to link information.

parameter

A character value of parameter term name. The term name is used as key to link information.

type

A character value to control title name, e.g., Subjects or Records.

use_na

A character value for whether to include NA values in the table. See the useNA argument in base::table() for more details.

display_total

A logical value to display total column.

Value

A list containing number of subjects

Examples

meta <- meta_sl_example()
meta |> collect_baseline(
  population = "apat",
  parameter = "age"
)

Deformat percent

Description

Deformat percent

Usage

defmt_pct(pct)

Arguments

pct

string eager to remove percent

Value

Numeric value without percent

Examples

defmt_pct("10.0%")
defmt_pct(c("10.0%", "(11.2%)"))

Add cumulative count and summary stats for categories for exposure duration analysis

Description

Add cumulative count and summary stats for categories for exposure duration analysis

Usage

extend_exp_duration(
  outdata,
  category_section_label = NULL,
  duration_category_list = NULL,
  duration_category_labels = NULL
)

Arguments

outdata

An outdata object created by prepare_exp_duration().

category_section_label

A character value of section label. If NULL, the parameter label is used with "(cumulative)".

duration_category_list

A list of duration category ranges. Must be real numbers and may overlap or be mutually exclusive. A list should be in the form of list(c(low1, high1), c(low2, high2), ...). If NA is included in the range, it is treated as -Inf or Inf. The range is defined as ⁠low <= x < high⁠ for each.

duration_category_labels

A character vector of internal labels. Labels to be displayed for the duration_category_list values. Must be the same length as duration_category_list.

Value

A list of analysis raw datasets.

Examples

meta <- meta_sl_exposure_example()
outdata <- meta |> prepare_exp_duration()
outdata |>
  extend_exp_duration(
    duration_category_list = list(c(1, NA), c(7, NA), c(21, NA)),
    duration_category_labels = c(">=1 day", ">=7 days", ">=21 days")
  )

Format Baseline Characteristics Analysis

Description

Format Baseline Characteristics Analysis

Usage

format_base_char(
  outdata,
  display_col = c("n", "prop", "total"),
  digits_prop = 1,
  display_stat = c("mean", "sd", "se", "median", "q1 to q3", "range")
)

Arguments

outdata

A metadata object created by prepare_sl_summary().

display_col

Column wants to display on the table. The term could be selected from c("n", "prop", "total").

digits_prop

Number of digits for proportion columns.

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").

Value

A list of analysis raw datasets.

Examples

meta <- meta_sl_example()

meta |>
  prepare_base_char(population = "apat", parameter = "age;gender") |>
  format_base_char()

Prepare data for Subgroup Analysis for Baseline Characteristic

Description

Prepare data for Subgroup Analysis for Baseline Characteristic

Usage

format_base_char_subgroup(
  outdata,
  display = c("n", "prop", "total"),
  display_stat = c("mean", "sd", "median", "range")
)

Arguments

outdata

A metadata object created by prepare_base_char_subgroup().

display

Column wants to display on the table. The term could be selected from c("n", "prop", "total").

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").

Value

A list of analysis raw datasets.

Examples

meta <- meta_sl_example()

outdata <- prepare_base_char_subgroup(
  meta,
  population = "apat",
  parameter = "age",
  subgroup_var = "TRTA",
  subgroup_header = c("SEX", "TRTA"),
  display_subgroup_total = TRUE
)

outdata |> format_base_char_subgroup()

Format Disposition Analysis

Description

Format Disposition Analysis

Usage

format_disposition(
  outdata,
  display_col = c("n", "prop", "total"),
  digits_prop = 1,
  display_stat = c("mean", "sd", "se", "median", "q1 to q3", "range")
)

Arguments

outdata

A metadata object created by prepare_sl_summary().

display_col

Column wants to display on the table. The term could be selected from c("n", "prop", "total").

digits_prop

Number of digits for proportion columns.

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").

Value

A list of analysis raw datasets.

Examples

meta <- meta_sl_example()

meta |>
  prepare_disposition(population = "apat", parameter = "disposition;medical-disposition") |>
  format_disposition()

Format Exposure Duration Analysis

Description

Format Exposure Duration Analysis

Usage

format_exp_duration(
  outdata,
  display_col = c("n", "prop", "n_cum", "prop_cum", "total"),
  digits_prop = 1,
  display_stat = c("mean", "sd", "se", "median", "q1 to q3", "range")
)

Arguments

outdata

A metadata object created by prepare_sl_summary().

display_col

Column wants to display on the table. "n_cum", "prop_cum" can additionally be selected.

  • n_cum: Number of subjects created by extend_exp_duration().

  • prop_cum: Proportion of subjects created by extend_exp_duration().

digits_prop

Number of digits for proportion columns.

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").

Value

A list of analysis raw datasets.

Examples

meta <- meta_sl_exposure_example()

meta |>
  prepare_exp_duration(population = "apat", parameter = "expdur") |>
  format_exp_duration(display_col = c("n", "prop", "total"))

Prepare data for baseline characteristic table

Description

Prepare data for baseline characteristic table

Usage

format_sl_summary(
  outdata,
  display_col = c("n", "prop", "total"),
  digits_prop = 1,
  display_stat = c("mean", "sd", "se", "median", "q1 to q3", "range")
)

Arguments

outdata

A metadata object created by prepare_sl_summary().

display_col

Column wants to display on the table. The term could be selected from c("n", "prop", "total").

digits_prop

Number of digits for proportion columns.

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").

Value

A list of analysis raw datasets.

Examples

meta <- meta_sl_example()

meta |>
  prepare_sl_summary(population = "apat", analysis = "base_char", parameter = "age;gender") |>
  format_sl_summary()

Format Treatment Compliance Analysis

Description

Format Treatment Compliance Analysis

Format Treatment Compliance Analysis

Usage

format_trt_compliance(
  outdata,
  display_col = c("n", "prop", "total"),
  digits_prop = 1,
  display_stat = c("mean", "sd", "se", "median", "q1 to q3", "range")
)

format_trt_compliance(
  outdata,
  display_col = c("n", "prop", "total"),
  digits_prop = 1,
  display_stat = c("mean", "sd", "se", "median", "q1 to q3", "range")
)

Arguments

outdata

A metadata object created by prepare_sl_summary().

display_col

Column wants to display on the table. The term could be selected from c("n", "prop", "total").

digits_prop

Number of digits for proportion columns.

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").

Value

A list of analysis raw datasets.

A list of analysis raw datasets.

Examples

meta <- meta_sl_example()

meta |>
  prepare_trt_compliance(parameter = "comp8;comp16") |>
  format_trt_compliance()
meta <- meta_sl_example()

meta |>
  prepare_trt_compliance(population = "apat", parameter = "comp8;comp16") |>
  format_trt_compliance()

Create metadata for subject-level analysis table

Description

Create metadata for subject-level analysis table

Usage

meta_sl(
  dataset_population,
  dataset_observation = NULL,
  population_term,
  observation_term = NULL,
  parameter_term = "age;race;gender",
  parameter_var = "AGE^AGEGR1;RACE;SEX",
  parameter_labels = NULL,
  analysis_term = "base_char",
  analysis_title = "Participant Baseline Characteristics by Treatment Group",
  population_subset = SAFFL == "Y",
  observation_subset = NULL,
  population_label = "All Participants as Treated",
  treatment_group = "TRT01A"
)

Arguments

dataset_population

Source dataset of population.

dataset_observation

Source dataset of observation

population_term

A character value of population term name.

observation_term

A character value of observation term name.

parameter_term

A character value of parameter term name. If there are multiple terms, they are separated by the semicolon (;).

parameter_var

A character value of parameter variable name. If there are multiple variables, they are separated by the semicolon (;). A group variable can be specified followed by a variable and the hat symbol (^).

parameter_labels

A character vector of parameter label name. The length of vector should be the same as the number of parameter terms. A label from an input data is used if NA for a variable is specified.

analysis_term

A character value of analysis term name.

analysis_title

A character value of analysis title name.

population_subset

An unquoted condition for selecting the populations from dataset of population.

observation_subset

An unquoted condition for selecting the populations from dataset of observation

population_label

A character value of population label.

treatment_group

A character value of treatment group name.

Value

A metalite object.

Examples

meta_sl(
  dataset_population = r2rtf::r2rtf_adsl,
  population_term = "apat",
  parameter_term = "age;race",
  parameter_var = "AGE^AGEGR1;RACE"
)

Create an example meta_sl_example object

Description

This function is only for illustration purpose. r2rtf is required.

Usage

meta_sl_example()

Value

A metadata object.

Examples

meta_sl_example()

Create an example meta_sl_exposure_example object

Description

This function is only for illustration purpose. r2rtf is required.

Usage

meta_sl_exposure_example()

Value

A metadata object.

Examples

meta_sl_exposure_example()

Create an interactive plot for exposure duration

Description

Create an interactive plot for exposure duration

Usage

plotly_exp_duration(
  outdata,
  color = NULL,
  display = c("n", "prop"),
  display_total = TRUE,
  plot_group_label = "Treatment group",
  plot_category_label = "Exposure duration",
  hover_summary_var = c("n", "median", "sd", "se", "median", "min", "max", "q1 to q3",
    "range"),
  width = 1000,
  height = 400
)

Arguments

outdata

An outdata object created from prepare_exp_duration(). extend_exp_duration() can also be applied.

color

Color for a histogram.

display

A character vector of display type. n or prop can be selected.

display_total

A logical value to display total.

plot_group_label

A label for grouping.

plot_category_label

A label for category.

hover_summary_var

A character vector of statistics to be displayed on hover label of bar.

width

Width of the plot.

height

Height of the plot.

Value

Interactive plot for exposure duration.

Examples

# Only run this example in interactive R sessions
if (interactive()) {
  meta <- meta_sl_exposure_example()
  outdata <- meta |>
    prepare_exp_duration() |>
    extend_exp_duration(
      duration_category_list = list(c(1, 7), c(7, 21), c(21, 84)),
      duration_category_labels = c("1-7 days", "7-21 days", "21-84 days")
    )

  outdata |> plotly_exposure_duration()
}

Prepare data for baseline characteristic table

Description

Prepare data for baseline characteristic table

Usage

prepare_base_char(
  meta,
  analysis = "base_char",
  population = meta$plan[meta$plan$analysis == analysis, ]$population,
  parameter = paste(meta$plan[meta$plan$analysis == analysis, ]$parameter, collapse =
    ";")
)

Arguments

meta

A metadata object created by metalite.

analysis

A character value of analysis term name. The term name is used as key to link information.

population

A character value of population term name. The term name is used as key to link information.

parameter

A character value of parameter term name. The term name is used as key to link information.

Value

A list of analysis raw datasets.

Examples

meta <- meta_sl_example()
meta |> prepare_base_char()

Prepare data for treatment compliance table

Description

Prepare data for treatment compliance table

Usage

prepare_base_char_subgroup(
  meta,
  population,
  analysis = "base_char_subgroup",
  parameter,
  subgroup_var,
  subgroup_header = c(meta$population[[population]]$group, subgroup_var),
  display_subgroup_total = TRUE
)

Arguments

meta

A metadata object created by metalite.

population

A character value of population term name. The term name is used as key to link information.

analysis

A character value of analysis term name. The term name is used as key to link information.

parameter

A character value of parameter term name. The term name is used as key to link information.

subgroup_var

A character value of subgroup variable name in observation data saved in meta$data_observation.

subgroup_header

A character vector for column header hierarchy. The first element will be the first level header and the second element will be second level header.

display_subgroup_total

A logic value of displaying the total group.

Value

A list of analysis raw datasets.

Examples

meta <- meta_sl_example()
outdata <- prepare_base_char_subgroup(
  meta,
  population = "apat",
  parameter = "age",
  subgroup_var = "TRTA",
  subgroup_header = c("SEX", "TRTA"),
  display_subgroup_total = TRUE
)

Prepare data for treatment compliance table

Description

Prepare data for treatment compliance table

Usage

prepare_disposition(
  meta,
  analysis = "disp",
  population = meta$plan[meta$plan$analysis == analysis, ]$population,
  parameter = paste(meta$plan[meta$plan$analysis == analysis, ]$parameter, collapse =
    ";")
)

Arguments

meta

A metadata object created by metalite.

analysis

A character value of analysis term name. The term name is used as key to link information.

population

A character value of population term name. The term name is used as key to link information.

parameter

A character value of parameter term name. The term name is used as key to link information.

Value

A list of analysis raw datasets.

Examples

meta <- meta_sl_example()
meta |> prepare_base_char()

Prepare data for exposure duration table

Description

Prepare data for exposure duration table

Usage

prepare_exp_duration(
  meta,
  analysis = "exp_dur",
  population = meta$plan[meta$plan$analysis == analysis, ]$population,
  parameter = paste(meta$plan[meta$plan$analysis == analysis, ]$parameter, collapse =
    ";")
)

Arguments

meta

A metadata object created by metalite.

analysis

A character value of analysis term name. The term name is used as key to link information.

population

A character value of population term name. The term name is used as key to link information.

parameter

A character value of parameter term name. The term name is used as key to link information.

Value

A list of analysis raw datasets.

Examples

meta <- meta_sl_exposure_example()
meta |> prepare_exp_duration()

Prepare data for baseline characteristic table

Description

Prepare data for baseline characteristic table

Usage

prepare_sl_summary(
  meta,
  population,
  analysis,
  parameter = paste(names(meta$parameter), collapse = ";")
)

Arguments

meta

A metadata object created by metalite.

population

A character value of population term name. The term name is used as key to link information.

analysis

A character value of analysis term name. The term name is used as key to link information.

parameter

A character value of parameter term name. The term name is used as key to link information.

Value

A list of analysis raw datasets.

Examples

meta <- meta_sl_example()
meta |> prepare_sl_summary(population = "apat", analysis = "base_char")

Prepare data for treatment compliance table

Description

Prepare data for treatment compliance table

Usage

prepare_trt_compliance(
  meta,
  analysis = "trt_compliance",
  population = meta$plan[meta$plan$analysis == analysis, ]$population,
  parameter = paste(meta$plan[meta$plan$analysis == analysis, ]$parameter, collapse =
    ";")
)

Arguments

meta

A metadata object created by metalite.

analysis

A character value of analysis term name. The term name is used as key to link information.

population

A character value of population term name. The term name is used as key to link information.

parameter

A character value of parameter term name. The term name is used as key to link information.

Value

A list of analysis raw datasets.

Examples

meta <- meta_sl_example()
meta |> prepare_trt_compliance()

Display interactive baseline characteristic tables with AE subgroup analysis

Description

Display interactive baseline characteristic tables with AE subgroup analysis

Usage

react_base_char(
  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
)

Arguments

metadata_sl

A metadata created by metalite, which builds the baseline characteristic table

metadata_ae

A metadata created by metalite, which builds the AE subgroup specific table

population

A character value of population term name. The term name is used as key to link information.

observation

A character value of observation term name. The term name is used as key to link information.

display_total

Display total column or not.

sl_parameter

A character value of parameter term name for the baseline characteristic table. The term name is used as key to link information.

ae_subgroup

A vector of strubf to specify the subgroups in the AE subgroup specific table.

ae_specific

A string specifying the AE specific category.

width

A numeric value of width of the table in pixels.

Value

An reactable combing both baseline characteristic table and AE subgroup specific tables.

Examples

if (interactive()) {
  react_base_char(
    metadata_sl = meta_sl_example(),
    metadata_ae = metalite.ae::meta_ae_example(),
    population = "apat",
    observation = "wk12",
    display_total = TRUE,
    sl_parameter = "age;gender;race",
    ae_subgroup = c("age", "race", "gender"),
    ae_specific = "rel",
    width = 1200
  )
}

Display interactive disposition tables with AE subgroup analysis

Description

Display interactive disposition tables with AE subgroup analysis

Usage

react_disposition(
  metadata_sl,
  metadata_ae,
  analysis = "disp",
  population = metadata_sl$plan[metadata_sl$plan$analysis == analysis, ]$population,
  sl_parameter = paste(metadata_sl$plan[metadata_sl$plan$analysis == analysis,
    ]$parameter, collapse = ";"),
  display_total = TRUE,
  width = 1200
)

Arguments

metadata_sl

A metadata created by metalite, which builds the baseline characteristic table

metadata_ae

A metadata created by metalite, which builds the AE subgroup specific table

analysis

The analysis label provided in metadata_sl.

population

A character value of population term name. The term name is used as key to link information.

sl_parameter

A character value of parameter term name for the baseline characteristic table. The term name is used as key to link information.

display_total

Display total column or not.

width

A numeric value of width of the table in pixels.

Value

An reactable combing both baseline characteristic table and AE subgroup specific tables.

Examples

if (interactive()) {
  react_disposition(
    metadata_sl = meta_sl_example(),
    metadata_ae = metalite.ae::meta_ae_example(),
    width = 1200
  )
}

Baseline characteristic table

Description

Baseline characteristic table

Usage

rtf_base_char(
  outdata,
  source,
  col_rel_width = NULL,
  text_font_size = 9,
  orientation = "portrait",
  footnotes = NULL,
  title = NULL,
  path_outdata = NULL,
  path_outtable = NULL
)

Arguments

outdata

An outdata object created by prepare_sl_summary().

source

A character value of the data source.

col_rel_width

Column relative width in a vector e.g. c(2,1,1) refers to 2:1:1. Default is NULL for equal column width.

text_font_size

Text font size. To vary text font size by column, use numeric vector with length of vector equal to number of columns displayed e.g. c(9,20,40).

orientation

Orientation in 'portrait' or 'landscape'.

footnotes

A character vector of table footnotes.

title

Term "analysis", "observation" and "population") for collecting title from metadata or a character vector of table titles.

path_outdata

A character string of the outdata path.

path_outtable

A character string of the outtable path.

Value

A list of analysis raw datasets.

Examples

meta <- meta_sl_example()

meta |>
  prepare_base_char(
    population = "apat",
    analysis = "base_char",
    parameter = "age;gender"
  ) |>
  format_base_char() |>
  rtf_base_char(
    source = "Source: [CDISCpilot: adam-adsl]",
    path_outdata = tempfile(fileext = ".Rdata"),
    path_outtable = tempfile(fileext = ".rtf")
  )

Subgroup Analysis for Baseline Characteristic

Description

Subgroup Analysis for Baseline Characteristic

Usage

rtf_base_char_subgroup(
  outdata,
  source,
  col_rel_width = NULL,
  text_font_size = 8,
  orientation = "landscape",
  footnotes = NULL,
  title = NULL,
  path_outdata = NULL,
  path_outtable = NULL
)

Arguments

outdata

An outdata object created by prepare_base_char_subgroup()

source

A character value of the data source.

col_rel_width

Column relative width in a vector e.g. c(2,1,1) refers to 2:1:1. Default is NULL for equal column width.

text_font_size

Text font size. To vary text font size by column, use numeric vector with length of vector equal to number of columns displayed e.g. c(9,20,40).

orientation

Orientation in 'portrait' or 'landscape'.

footnotes

A character vector of table footnotes.

title

Term "analysis", "observation" and "population") for collecting title from metadata or a character vector of table titles.

path_outdata

A character string of the outdata path.

path_outtable

A character string of the outtable path.

Value

RTF file and source dataset for baseline characteristic table.

Examples

meta <- meta_sl_example()

outdata <- prepare_base_char_subgroup(
  meta,
  population = "apat",
  parameter = "age",
  subgroup_var = "TRTA",
  subgroup_header = c("SEX", "TRTA"),
  display_subgroup_total = TRUE
)

outdata |>
  format_base_char_subgroup() |>
  rtf_base_char_subgroup(
    source = "Source:  [CDISCpilot: adam-adsl]",
    path_outdata = tempfile(fileext = ".Rdata"),
    path_outtable = tempfile(fileext = ".rtf")
  )

Disposition table

Description

Disposition table

Usage

rtf_disposition(
  outdata,
  source,
  col_rel_width = NULL,
  text_font_size = 9,
  orientation = "portrait",
  footnotes = NULL,
  title = NULL,
  path_outdata = NULL,
  path_outtable = NULL
)

Arguments

outdata

An outdata object created by prepare_sl_summary().

source

A character value of the data source.

col_rel_width

Column relative width in a vector e.g. c(2,1,1) refers to 2:1:1. Default is NULL for equal column width.

text_font_size

Text font size. To vary text font size by column, use numeric vector with length of vector equal to number of columns displayed e.g. c(9,20,40).

orientation

Orientation in 'portrait' or 'landscape'.

footnotes

A character vector of table footnotes.

title

Term "analysis", "observation" and "population") for collecting title from metadata or a character vector of table titles.

path_outdata

A character string of the outdata path.

path_outtable

A character string of the outtable path.

Value

A list of analysis raw datasets.

Examples

meta <- meta_sl_example()

meta |>
  prepare_disposition(population = "apat", parameter = "disposition;medical-disposition") |>
  format_disposition() |>
  rtf_disposition(
    source = "Source: [CDISCpilot: adam-adsl]",
    path_outdata = tempfile(fileext = ".Rdata"),
    path_outtable = tempfile(fileext = ".rtf")
  )

Exposure duration table

Description

Exposure duration table

Usage

rtf_exp_duration(
  outdata,
  source = "Source: [CDISCpilot: adam-adsl; adex]",
  col_rel_width = NULL,
  text_font_size = 9,
  orientation = "portrait",
  footnotes =
    c("Each participant is counted once on each applicable duration category row.",
    "Duration of Exposure is the time from the first dose date to the last dose date."),
  title = NULL,
  path_outdata = NULL,
  path_outtable = NULL
)

Arguments

outdata

An outdata object created by prepare_sl_summary().

source

A character value of the data source.

col_rel_width

Column relative width in a vector e.g. c(2,1,1) refers to 2:1:1. Default is NULL for equal column width.

text_font_size

Text font size. To vary text font size by column, use numeric vector with length of vector equal to number of columns displayed e.g. c(9,20,40).

orientation

Orientation in 'portrait' or 'landscape'.

footnotes

A character vector of table footnotes.

title

Term "analysis", "observation" and "population") for collecting title from metadata or a character vector of table titles.

path_outdata

A character string of the outdata path.

path_outtable

A character string of the outtable path.

Value

RTF file and source dataset for baseline characteristic table.

Examples

meta <- meta_sl_exposure_example()

meta |>
  prepare_exp_duration(population = "apat", parameter = "expdur") |>
  format_exp_duration(display_col = c("n", "prop", "total")) |>
  rtf_exp_duration(
    source = "Source: [CDISCpilot: adam-adsl; adex]",
    path_outdata = tempfile(fileext = ".Rdata"),
    path_outtable = tempfile(fileext = ".rtf")
  )

Baseline characteristic table

Description

Baseline characteristic table

Usage

rtf_sl_summary(
  outdata,
  source,
  col_rel_width = NULL,
  text_font_size = 9,
  orientation = "portrait",
  footnotes = NULL,
  title = NULL,
  path_outdata = NULL,
  path_outtable = NULL
)

Arguments

outdata

An outdata object created by prepare_sl_summary().

source

A character value of the data source.

col_rel_width

Column relative width in a vector e.g. c(2,1,1) refers to 2:1:1. Default is NULL for equal column width.

text_font_size

Text font size. To vary text font size by column, use numeric vector with length of vector equal to number of columns displayed e.g. c(9,20,40).

orientation

Orientation in 'portrait' or 'landscape'.

footnotes

A character vector of table footnotes.

title

Term "analysis", "observation" and "population") for collecting title from metadata or a character vector of table titles.

path_outdata

A character string of the outdata path.

path_outtable

A character string of the outtable path.

Value

RTF file and source dataset for baseline characteristic table.

Examples

meta <- meta_sl_example()

meta |>
  prepare_sl_summary(
    population = "apat",
    analysis = "base_char",
    parameter = "age;gender"
  ) |>
  format_sl_summary() |>
  rtf_sl_summary(
    source = "Source: [CDISCpilot: adam-adsl]",
    path_outdata = tempfile(fileext = ".Rdata"),
    path_outtable = tempfile(fileext = ".rtf")
  )

Treatment compliance table

Description

Treatment compliance table

Usage

rtf_trt_compliance(
  outdata,
  source,
  col_rel_width = NULL,
  text_font_size = 9,
  orientation = "portrait",
  footnotes = NULL,
  title = NULL,
  path_outdata = NULL,
  path_outtable = NULL
)

Arguments

outdata

An outdata object created by prepare_sl_summary().

source

A character value of the data source.

col_rel_width

Column relative width in a vector e.g. c(2,1,1) refers to 2:1:1. Default is NULL for equal column width.

text_font_size

Text font size. To vary text font size by column, use numeric vector with length of vector equal to number of columns displayed e.g. c(9,20,40).

orientation

Orientation in 'portrait' or 'landscape'.

footnotes

A character vector of table footnotes.

title

Term "analysis", "observation" and "population") for collecting title from metadata or a character vector of table titles.

path_outdata

A character string of the outdata path.

path_outtable

A character string of the outtable path.

Value

A list of analysis raw datasets.

Examples

meta <- meta_sl_example()

meta |>
  prepare_trt_compliance(population = "apat", parameter = "comp8;comp16") |>
  format_trt_compliance() |>
  rtf_trt_compliance(
    source = "Source: [CDISCpilot: adam-adsl]",
    path_outdata = tempfile(fileext = ".Rdata"),
    path_outtable = tempfile(fileext = ".rtf")
  )