Title: | Slides automation with R |
---|---|
Description: | Slides automation with R. |
Authors: | Joe Zhu [cre, aut], Heng Wang [aut], Yinqi Zhao [aut], Bo Ci [aut], Liming Li [aut], Laura Wang [ctb], Xiaoli Duan [aut], Stefan Pascal Thoma [aut], Thomas Neitmann [ctb], Miles Almond [aut], Mahdi About [ctb], Kai Lim [ctb], Nolan Steed [ctb], Daoling Pang [ctb], Elisabeth Deutschmann [ctb], Chenkai Lv [aut] |
Maintainer: | Joe Zhu <[email protected]> |
License: | file LICENSE |
Version: | 0.0.1.9033 |
Built: | 2024-11-18 07:23:38 UTC |
Source: | https://github.com/insightsengineering/autoslider.core |
Slides automation with R.
Maintainer: Joe Zhu [email protected]
Authors:
Heng Wang
Yinqi Zhao
Bo Ci
Liming Li
Xiaoli Duan
Stefan Pascal Thoma
Miles Almond
Chenkai Lv
Other contributors:
Laura Wang [contributor]
Thomas Neitmann [contributor]
Mahdi About [contributor]
Kai Lim [contributor]
Nolan Steed [contributor]
Daoling Pang [contributor]
Elisabeth Deutschmann [contributor]
Useful links:
autoslider_error class
autoslider_error(x, spec, step)
autoslider_error(x, spec, step)
x |
character scaler |
spec |
spec should be a list containing "program" and "suffix" |
step |
step is a character indicating in which step the pipeline encounter error |
this function is used to create autoslider_error object. this function is for internal use only to create the autoslider_error object. It enable us for further functionalities, like providing help on easy debugging, e.g. if the error is inside the user function, provide the call and let the user run the code outside the pipeline.
Zebra themed color
autoslider_format( ft, odd_header = "#0EAED5", odd_body = "#EBF5FA", even_header = "#0EAED5", even_body = "#D0E4F2", font_name = "arial", body_font_size = 12, header_font_size = 14 ) blue_format(ft, ...) orange_format(ft, ...) red_format(ft, ...) purple_format(ft, ...) autoslider_dose_format(ft, header_vals = names(ft)) white_format(ft, ...) black_format(ft, ...)
autoslider_format( ft, odd_header = "#0EAED5", odd_body = "#EBF5FA", even_header = "#0EAED5", even_body = "#D0E4F2", font_name = "arial", body_font_size = 12, header_font_size = 14 ) blue_format(ft, ...) orange_format(ft, ...) red_format(ft, ...) purple_format(ft, ...) autoslider_dose_format(ft, header_vals = names(ft)) white_format(ft, ...) black_format(ft, ...)
ft |
flextable object |
odd_header |
Hex color code, default to deep sky blue |
odd_body |
Hex color code, default to alice blue |
even_header |
Hex color code, default to slate gray |
even_body |
Hex color code, default to slate gray |
font_name |
Font name, default to arial |
body_font_size |
Font size of the table content, default to 12 |
header_font_size |
Font size of the table header, default to 14 |
... |
arguments passed to program |
header_vals |
Header |
autoslider_format()
: User defined color code and font size
blue_format()
: Blue color theme
orange_format()
: Orange color theme
red_format()
: Red color theme
purple_format()
: Purple color theme
autoslider_dose_format()
: 'AutoslideR' dose formats
white_format()
: White color theme
black_format()
: Black color theme
Build table header, a utility function to help with construct structured header for table layout
build_table_header(anl, arm, split_by_study, side_by_side)
build_table_header(anl, arm, split_by_study, side_by_side)
anl |
analysis data object |
arm |
Arm variable for column split |
split_by_study |
if true, construct structured header with the study ID |
side_by_side |
A logical value indicating whether to display the data side by side. |
Create location container to center the figure, based on ppt size and user specified figure size
center_figure_loc(fig_width, fig_height, ppt_width, ppt_height)
center_figure_loc(fig_width, fig_height, ppt_width, ppt_height)
fig_width |
Figure width |
fig_height |
Figure height |
ppt_width |
Slide width |
ppt_height |
Slide height |
Location for a placeholder from scratch
create location container to center the table
center_table_loc(ft, ppt_width, ppt_height)
center_table_loc(ft, ppt_width, ppt_height)
ft |
Flextable object |
ppt_width |
Powerpoint width |
ppt_height |
Powerpoint height |
Location for a placeholder
Assert function to check the cutoff
check_and_set_cutoff(data, cutoff)
check_and_set_cutoff(data, cutoff)
data |
dataframe |
cutoff |
cutoff threshold |
Concatenate arguments into a string
dec_paste(...)
dec_paste(...)
... |
arguments passed to program |
generic function decorate
s3 method for decorate
decorate(x, ...) decorate(x, ...)
decorate(x, ...) decorate(x, ...)
x |
object to decorate |
... |
additional arguments passed to methods |
Decorate outputs with titles and footnotes
decorate_outputs( outputs, generic_title = NULL, generic_footnote = "Confidential and for internal use only", version_label = get_version_label_output(), for_test = FALSE )
decorate_outputs( outputs, generic_title = NULL, generic_footnote = "Confidential and for internal use only", version_label = get_version_label_output(), for_test = FALSE )
outputs |
'list' of output objects as created by 'generate_outputs' |
generic_title |
'character' vector of titles |
generic_footnote |
'character' vector of footnotes |
version_label |
'character'. A version label to be added to the title. |
for_test |
'logic' CICD parameter |
'generic_title' and 'generic_footnote' will be added to *all* outputs. The use case is to add information such as protocol number and snapshot date defined in a central place (e.g. metadata.yml) to *every* output.
'version_label' must be either '"DRAFT"', '"APPROVED"' or 'NULL'. By default, when outputs are created on the master branch it is set to 'NULL', i.e. no version label will be displayed. Otherwise '"DRAFT"' will be added. To add '"APPROVED"' to the title you will need to explicitly set 'version_label = "APPROVED"'.
decorate listing
## S4 method for signature 'listing_df' decorate(x, titles = "", footnotes = "", paper = "P8", for_test = FALSE, ...)
## S4 method for signature 'listing_df' decorate(x, titles = "", footnotes = "", paper = "P8", for_test = FALSE, ...)
x |
A listing_df object representing the data to be decorated. |
titles |
Title to be added to the table. |
footnotes |
Footnote to be added to the table |
paper |
Orientation and font size as string, e.g. "P8"; "L11" |
for_test |
'logic' CICD parameter |
... |
Additional arguments. not used. |
Decorate TableTree
## S4 method for signature 'VTableTree' decorate(x, titles = "", footnotes = "", paper = "P8", for_test = FALSE, ...)
## S4 method for signature 'VTableTree' decorate(x, titles = "", footnotes = "", paper = "P8", for_test = FALSE, ...)
x |
A VTableTree object representing the data to be decorated. |
titles |
Title to be added to the table. |
footnotes |
Footnote to be added to the table |
paper |
Orientation and font size as string, e.g. "P8"; "L11" |
for_test |
'logic' CICD parameter |
... |
Additional arguments passed to the decoration function. |
decorate method for autoslider_error class
decorate.autoslider_error(x, ...)
decorate.autoslider_error(x, ...)
x |
object to decorate |
... |
additional arguments. not used. |
default method to decorate
decorate.default(x, ...)
decorate.default(x, ...)
x |
object to decorate |
... |
additional arguments. not used. |
Decorate ggplot object
decorate.ggplot( x, titles = "", footnotes = "", paper = "L11", for_test = FALSE, ... )
decorate.ggplot( x, titles = "", footnotes = "", paper = "L11", for_test = FALSE, ... )
x |
An object to decorate |
titles |
Plot titles |
footnotes |
Plot footnotes |
paper |
Paper size, by default "L11" |
for_test |
'logic' CICD parameter |
... |
additional arguments. not used. |
The paper default paper size, 'L11', indicate that the fontsize is 11. The fontsize of the footnotes, is the fontsize of the titles minus 2.
decorate grob
decorate.grob(x, titles, footnotes, paper = "L11", for_test = FALSE, ...)
decorate.grob(x, titles, footnotes, paper = "L11", for_test = FALSE, ...)
x |
object to decorate |
titles |
graph titles |
footnotes |
graph footnotes |
paper |
paper size. default is "L8". |
for_test |
'logic' CICD parameter |
... |
Additional arguments. not used. |
The paper default paper size, 'L11', indicate that the fontsize is 11. The fontsize of the footnotes, is the fontsize of the titles minus 2.
decorate list of grobs
decorate.list(x, titles, footnotes, paper = "L11", for_test = FALSE, ...)
decorate.list(x, titles, footnotes, paper = "L11", for_test = FALSE, ...)
x |
object to decorate |
titles |
graph titles |
footnotes |
graph footnotes |
paper |
paper size. default is "L11". |
for_test |
'logic' CICD parameter |
... |
additional arguments. not used |
The paper default paper size, 'L11', indicate that the fontsize is 11. The fontsize of the footnotes, is the fontsize of the titles minus 2.
Cached ADAE data
data(eg_adae)
data(eg_adae)
An object of class tbl_df
(inherits from tbl
, data.frame
) with 1934 rows and 93 columns.
Cached ADEG data
data(eg_adeg)
data(eg_adeg)
An object of class tbl_df
(inherits from tbl
, data.frame
) with 13600 rows and 88 columns.
Cached ADEX data
data(eg_adex)
data(eg_adex)
An object of class tbl_df
(inherits from tbl
, data.frame
) with 6400 rows and 79 columns.
Cached ADLB data
data(eg_adlb)
data(eg_adlb)
An object of class tbl_df
(inherits from tbl
, data.frame
) with 8400 rows and 102 columns.
Cached ADRS data
data(eg_adrs)
data(eg_adrs)
An object of class tbl_df
(inherits from tbl
, data.frame
) with 3200 rows and 65 columns.
Cached ADSL data
data(eg_adsl)
data(eg_adsl)
An object of class tbl_df
(inherits from tbl
, data.frame
) with 400 rows and 55 columns.
Cached ADTR data
data(eg_adtr)
data(eg_adtr)
An object of class data.frame
with 2800 rows and 76 columns.
Cached ADTTE data
data(eg_adtte)
data(eg_adtte)
An object of class tbl_df
(inherits from tbl
, data.frame
) with 2000 rows and 67 columns.
Cached ADVS data
data(eg_advs)
data(eg_advs)
An object of class tbl_df
(inherits from tbl
, data.frame
) with 16800 rows and 87 columns.
copied from ms showcase app
fastDoCall(what, args, quote = FALSE, envir = parent.frame())
fastDoCall(what, args, quote = FALSE, envir = parent.frame())
what |
either a function or a non-empty character string naming the function to be called. |
args |
a list of arguments to the function call. The names attribute of args gives the argument names. |
quote |
a logical value indicating whether to quote the arguments. |
envir |
an environment within which to evaluate the call. This will be most useful if what is a character string and the arguments are symbols or quoted expressions. |
Add figure to slides
figure_to_slide( ppt, content, decor = TRUE, fig_width, fig_height, figure_loc = ph_location_type("body"), ... )
figure_to_slide( ppt, content, decor = TRUE, fig_width, fig_height, figure_loc = ph_location_type("body"), ... )
ppt |
slide page |
content |
content to be added |
decor |
should decoration be added |
fig_width |
user specified figure width |
fig_height |
user specified figure height |
figure_loc |
location of the figure. Defaults to 'ph_location_type("body")' |
... |
arguments passed to program |
slide with the added content
Filter a spec object
filter_spec(spec, filter_expr, verbose = TRUE)
filter_spec(spec, filter_expr, verbose = TRUE)
spec |
A 'spec' object as returned by 'read_spec()' |
filter_expr |
A 'logical' expression indicating outputs to keep |
verbose |
Should a message about the number of outputs matching 'filter_spec' be printed? Defaults to 'TRUE'. |
A 'spec' object containing only the outputs matching 'filter_expr'
Thomas Neitmann ('neitmant')
library(dplyr) spec_file <- system.file("spec.yml", package = "autoslider.core") spec <- spec_file %>% read_spec() ## Keep only outputs belonging to batch 2 ## Not run: filter_spec(spec, batch == 2) ## End(Not run) ## Keep only the t_dm_IT output filter_spec(spec, output == "t_dm_IT") ## Same as above but more verbose filter_spec(spec, program == "t_dm" && suffix == "IT") ## Keep all t_ae outputs filter_spec(spec, program == "t_ae") ## Keep all output run on safety population filter_spec(spec, "SE" %in% suffix) ## Keep t_dm_CHN_IT and t_dm_CHN_SE filter_spec(spec, program == "t_dm" && suffix %in% c("CHN_IT", "CHN_SE")) ## Keep all tables filter_spec(spec, grepl("^t_", program))
library(dplyr) spec_file <- system.file("spec.yml", package = "autoslider.core") spec <- spec_file %>% read_spec() ## Keep only outputs belonging to batch 2 ## Not run: filter_spec(spec, batch == 2) ## End(Not run) ## Keep only the t_dm_IT output filter_spec(spec, output == "t_dm_IT") ## Same as above but more verbose filter_spec(spec, program == "t_dm" && suffix == "IT") ## Keep all t_ae outputs filter_spec(spec, program == "t_ae") ## Keep all output run on safety population filter_spec(spec, "SE" %in% suffix) ## Keep t_dm_CHN_IT and t_dm_CHN_SE filter_spec(spec, program == "t_dm" && suffix %in% c("CHN_IT", "CHN_SE")) ## Keep all tables filter_spec(spec, grepl("^t_", program))
Format of xx.xx (xx.xx, xx.xx)
format_3d(x, output)
format_3d(x, output)
x |
input array |
output |
output handle |
'dplyr::case_when()' will check all RHS expressions on the input, this means if these expressions return warnings, they will happen even then the input doesn't doesn't satisfy the LHS. For this reason, I had to 'quiet' all 'lubridate' functions. This 'format_date()' function was tested with the inputs in the examples, all gave the expected returned value, so there should be no issues.
format_date(x)
format_date(x)
x |
vector of dates in character, in 'yyyy-mm-dd' format |
A vector.
# expected to return "2019" format_date("2019") # expected to return "20APR2019" format_date("2019-04-20") # expected to return "" format_date("") # expected to return "18JUN2019" format_date("2019-06-18T10:32") # expected to return "APR2019" format_date("2019-04")
# expected to return "2019" format_date("2019") # expected to return "20APR2019" format_date("2019-04-20") # expected to return "" format_date("") # expected to return "18JUN2019" format_date("2019-06-18T10:32") # expected to return "APR2019" format_date("2019-04")
function wrapper to pass filtered data
func_wrapper(func, datasets, spec, verbose = TRUE)
func_wrapper(func, datasets, spec, verbose = TRUE)
func |
function name |
datasets |
list of raw datasets |
spec |
spec |
verbose |
whether to show verbose information |
a wrapped function using filtered adam
General notes
gen_notes()
gen_notes()
* Default arm variables are set to '"TRT01A"' for safety output, and '"TRT01P"' for efficacy output
Generate output and apply filters, titles, and footnotes
generate_output(program, datasets, spec, verbose_level = 2, ...)
generate_output(program, datasets, spec, verbose_level = 2, ...)
program |
program name |
datasets |
list of datasets |
spec |
spec |
verbose_level |
Verbose level of messages be displayed. See details for further information. |
... |
arguments passed to program |
'verbose_level' is used to control how many messages are printed out. By default, '2' will show all filter messages and show output generation message. '1' will show output generation message only. '0' will display no message.
Liming Li ('Lil128')
library(dplyr) filters::load_filters( yaml_file = system.file("filters.yml", package = "autoslider.core"), overwrite = TRUE ) spec_file <- system.file("spec.yml", package = "autoslider.core") spec <- spec_file %>% read_spec() data <- list( adsl = eg_adsl, adae = eg_adae ) generate_output("t_ae_slide", data, spec$t_ae_slide_SE)
library(dplyr) filters::load_filters( yaml_file = system.file("filters.yml", package = "autoslider.core"), overwrite = TRUE ) spec_file <- system.file("spec.yml", package = "autoslider.core") spec <- spec_file %>% read_spec() data <- list( adsl = eg_adsl, adae = eg_adae ) generate_output("t_ae_slide", data, spec$t_ae_slide_SE)
Generate all outputs from a spec
generate_outputs(spec, datasets, verbose_level = 2)
generate_outputs(spec, datasets, verbose_level = 2)
spec |
Specification list generated by 'read_spec' |
datasets |
A 'list' of datasets |
verbose_level |
Verbose level of messages be displayed. See details for further information. |
'verbose_level' is used to control how many messages are printed out. By default, '2' will show all filter messages and show output generation message. '1' will show output generation message only. '0' will display no message.
- Thomas Neitmann ('neitmant') - Liming Li ('Lil128')
library(dplyr, warn.conflicts = FALSE) data <- list( adsl = eg_adsl, adae = eg_adae ) filters::load_filters( yaml_file = system.file("filters.yml", package = "autoslider.core"), overwrite = TRUE ) spec_file <- system.file("spec.yml", package = "autoslider.core") spec_file %>% read_spec() %>% filter_spec(output %in% c("t_dm_slide_IT", "t_ae_slide_SE")) %>% generate_outputs(datasets = data)
library(dplyr, warn.conflicts = FALSE) data <- list( adsl = eg_adsl, adae = eg_adae ) filters::load_filters( yaml_file = system.file("filters.yml", package = "autoslider.core"), overwrite = TRUE ) spec_file <- system.file("spec.yml", package = "autoslider.core") spec_file %>% read_spec() %>% filter_spec(output %in% c("t_dm_slide_IT", "t_ae_slide_SE")) %>% generate_outputs(datasets = data)
generate slides based on output
generate_slides( outputs, outfile = "output.pptx", template = file.path(system.file(package = "autoslider.core"), "theme/basic.pptx"), fig_width = 9, fig_height = 6, t_lpp = 20, t_cpp = 200, l_lpp = 20, l_cpp = 150, ... )
generate_slides( outputs, outfile = "output.pptx", template = file.path(system.file(package = "autoslider.core"), "theme/basic.pptx"), fig_width = 9, fig_height = 6, t_lpp = 20, t_cpp = 200, l_lpp = 20, l_cpp = 150, ... )
outputs |
List of output |
outfile |
Out file path |
template |
Template file path |
fig_width |
figure width in inch |
fig_height |
figure height in inch |
t_lpp |
An integer specifying the table lines per page |
t_cpp |
An integer specifying the table columns per page |
l_lpp |
An integer specifying the listing lines per page |
l_cpp |
An integer specifying the listing columns per page |
... |
arguments passed to program |
# Example 1. When applying to the whole pipeline library(dplyr) data <- list( adsl = eg_adsl %>% dplyr::mutate(FASFL = SAFFL), adae = eg_adae ) filters::load_filters( yaml_file = system.file("filters.yml", package = "autoslider.core"), overwrite = TRUE ) spec_file <- system.file("spec.yml", package = "autoslider.core") spec_file %>% read_spec() %>% filter_spec(program %in% c("t_dm_slide")) %>% generate_outputs(datasets = data) %>% decorate_outputs() %>% generate_slides() # Example 2. When applying to an rtable object or an rlisting object adsl <- eg_adsl t_dm_slide(adsl, "TRT01P", c("SEX", "AGE")) %>% generate_slides()
# Example 1. When applying to the whole pipeline library(dplyr) data <- list( adsl = eg_adsl %>% dplyr::mutate(FASFL = SAFFL), adae = eg_adae ) filters::load_filters( yaml_file = system.file("filters.yml", package = "autoslider.core"), overwrite = TRUE ) spec_file <- system.file("spec.yml", package = "autoslider.core") spec_file %>% read_spec() %>% filter_spec(program %in% c("t_dm_slide")) %>% generate_outputs(datasets = data) %>% decorate_outputs() %>% generate_slides() # Example 2. When applying to an rtable object or an rlisting object adsl <- eg_adsl t_dm_slide(adsl, "TRT01P", c("SEX", "AGE")) %>% generate_slides()
Adjust title line break and font size
get_proper_title(title, max_char = 60, title_color = "#1C2B39")
get_proper_title(title, max_char = 60, title_color = "#1C2B39")
title |
Character string |
max_char |
Integer specifying the maximum number of characters in one line |
title_color |
Title color |
Build side by side layout by cbind
lyt_to_side_by_side(lyt, anl, side_by_side = NULL)
lyt_to_side_by_side(lyt, anl, side_by_side = NULL)
lyt |
layout object |
anl |
analysis data object |
side_by_side |
A logical value indicating whether to display the data side by side. |
Build side by side layout by cbind
lyt_to_side_by_side_two_data(lyt, anl, alt_counts_df, side_by_side = NULL)
lyt_to_side_by_side_two_data(lyt, anl, alt_counts_df, side_by_side = NULL)
lyt |
layout object |
anl |
analysis data object |
alt_counts_df |
alternative data frame for counts |
side_by_side |
A logical value indicating whether to display the data side by side. |
Refactor active arm
mutate_actarm( df, arm_var = "TRT01A", levels = c("PLACEBO + PACLITAXEL + CISPLATIN", "ATEZOLIZUMAB + TIRAGOLUMAB + PACLITAXEL + CISPLATIN"), labels = c("Pbo+Pbo+PC", "Tira+Atezo+PC") )
mutate_actarm( df, arm_var = "TRT01A", levels = c("PLACEBO + PACLITAXEL + CISPLATIN", "ATEZOLIZUMAB + TIRAGOLUMAB + PACLITAXEL + CISPLATIN"), labels = c("Pbo+Pbo+PC", "Tira+Atezo+PC") )
df |
Input dataframe |
arm_var |
Arm variable |
levels |
factor levels |
labels |
factor labels |
Replace NAs to NA
na_replace(table_df)
na_replace(table_df)
table_df |
Table dataframe |
Founding method
new_round(x, digits = 1)
new_round(x, digits = 1)
x |
number need to be rounded |
digits |
number of digits |
Null report
null_report()
null_report()
This will create a null report similar as STREAM does. You can use it inside output functions as shown in the example below.
Thomas Neitmann ('neitmant')
library(dplyr) library(filters) data <- list( adsl = eg_adsl, adae = eg_adae %>% mutate(AREL = "") ) null_report() ## An example how to use the `null_report()` inside an output function t_ae <- function(datasets) { trt <- "ACTARM" anl <- semi_join( datasets$adae, datasets$adsl, by = c("STUDYID", "USUBJID") ) return(null_report()) } data %>% apply_filter("SER_SE") %>% t_ae()
library(dplyr) library(filters) data <- list( adsl = eg_adsl, adae = eg_adae %>% mutate(AREL = "") ) null_report() ## An example how to use the `null_report()` inside an output function t_ae <- function(datasets) { trt <- "ACTARM" anl <- semi_join( datasets$adae, datasets$adsl, by = c("STUDYID", "USUBJID") ) return(null_report()) } data %>% apply_filter("SER_SE") %>% t_ae()
Format of (xx%, xx%)
perc_perc(x, output)
perc_perc(x, output)
x |
input array |
output |
output handle |
Placeholder for ph_with_img
ph_with_img(ppt, figure, fig_width, fig_height, figure_loc)
ph_with_img(ppt, figure, fig_width, fig_height, figure_loc)
ppt |
power point file |
figure |
image object |
fig_width |
width of figure |
fig_height |
height of figure |
figure_loc |
location of figure |
Preprocess t_dd function
preprocess_t_dd( df, levels = c("PROGRESSIVE DISEASE", "ADVERSE EVENT", "OTHER", "<Missing>"), labels = c("Progressive Disease", "Adverse Events", "Other", "<Missing>") )
preprocess_t_dd( df, levels = c("PROGRESSIVE DISEASE", "ADVERSE EVENT", "OTHER", "<Missing>"), labels = c("Progressive Disease", "Adverse Events", "Other", "<Missing>") )
df |
Input dataframe |
levels |
factor levels |
labels |
factor labels |
Preprocess t_ds function
preprocess_t_ds( df, levels = c("Alive: On Treatment", "Alive: In Follow-up", "<Missing>"), labels = c("Alive: On Treatment", "Alive: In Follow-up", "<Missing>") )
preprocess_t_ds( df, levels = c("Alive: On Treatment", "Alive: In Follow-up", "<Missing>"), labels = c("Alive: On Treatment", "Alive: In Follow-up", "<Missing>") )
df |
Input dataframe |
levels |
factor levels |
labels |
factor labels |
Print decorated grob
## S3 method for class 'decoratedGrob' print(x, ...)
## S3 method for class 'decoratedGrob' print(x, ...)
x |
An object of class 'decoratedGrob' |
... |
not used. |
Print decorated grob set
## S3 method for class 'decoratedGrobSet' print(x, ...)
## S3 method for class 'decoratedGrobSet' print(x, ...)
x |
An object of class 'decoratedGrobSet' |
... |
not used. |
Read yaml spec file and split according to filter lists
read_spec(spec_file = "spec.yml", metadata = NULL)
read_spec(spec_file = "spec.yml", metadata = NULL)
spec_file |
'character'. Path to a yaml spec file |
metadata |
Metadata of study |
An object of class 'spec' which is a 'list' where each element corresponds to one output, e.g. 't_dm_IT'.
- Liming Li ('Lil128') - Thomas Neitmann ('neitmant')
spec_file <- system.file("spec.yml", package = "autoslider.core") ## Take a look at the 'raw' content of the spec file cat(readLines(spec_file)[1:24], sep = "\n") ## This is how it looks once read into R spec <- read_spec(spec_file) spec[1:3]
spec_file <- system.file("spec.yml", package = "autoslider.core") ## Take a look at the 'raw' content of the spec file cat(readLines(spec_file)[1:24], sep = "\n") ## This is how it looks once read into R spec <- read_spec(spec_file) spec[1:3]
survival proportion afun
s_proportion_1( x, conf_level = 0.95, method = c("waldcc", "wald", "clopper-pearson", "wilson", "agresti-coull", "jeffreys"), long = FALSE )
s_proportion_1( x, conf_level = 0.95, method = c("waldcc", "wald", "clopper-pearson", "wilson", "agresti-coull", "jeffreys"), long = FALSE )
x |
data vector |
conf_level |
confidence level |
method |
type of method for calculation |
long |
flag |
survival time afun
s_surv_time_1(df, .var, is_event, control = control_surv_time())
s_surv_time_1(df, .var, is_event, control = control_surv_time())
df |
data |
.var |
variable of interest |
is_event |
vector indicating event |
control |
'control_surv_time()' by default |
Save an Output
save_output(output, file_name, save_rds = TRUE) save_output(output, file_name, save_rds = TRUE) save_output.autoslider_error(output, file_name, save_rds = TRUE) ## S4 method for signature 'dVTableTree' save_output(output, file_name, save_rds = TRUE) save_output.decoratedGrob(output, file_name, save_rds = TRUE) save_output.decoratedGrobSet(output, file_name, save_rds = TRUE) save_output.dlisting(output, file_name, save_rds = TRUE)
save_output(output, file_name, save_rds = TRUE) save_output(output, file_name, save_rds = TRUE) save_output.autoslider_error(output, file_name, save_rds = TRUE) ## S4 method for signature 'dVTableTree' save_output(output, file_name, save_rds = TRUE) save_output.decoratedGrob(output, file_name, save_rds = TRUE) save_output.decoratedGrobSet(output, file_name, save_rds = TRUE) save_output.dlisting(output, file_name, save_rds = TRUE)
output |
Output object, e.g. an 'rtable' or 'grob' |
file_name |
Full path of the new file *excluding* the extension |
save_rds |
Saved as an '.rds' files |
Tables are saved as RDS file
The input 'object' invisibly
library(dplyr) adsl <- eg_adsl %>% filter(SAFFL == "Y") %>% mutate(TRT01P = factor(TRT01P, levels = c("A: Drug X", "B: Placebo"))) output_dir <- tempdir() t_dm_slide(adsl, "TRT01P", c("SEX", "AGE", "RACE", "ETHNIC", "COUNTRY")) %>% decorate( title = "Demographic table", footnote = "" ) %>% save_output( file_name = file.path(output_dir, "t_dm_SE"), save_rds = TRUE )
library(dplyr) adsl <- eg_adsl %>% filter(SAFFL == "Y") %>% mutate(TRT01P = factor(TRT01P, levels = c("A: Drug X", "B: Placebo"))) output_dir <- tempdir() t_dm_slide(adsl, "TRT01P", c("SEX", "AGE", "RACE", "ETHNIC", "COUNTRY")) %>% decorate( title = "Demographic table", footnote = "" ) %>% save_output( file_name = file.path(output_dir, "t_dm_SE"), save_rds = TRUE )
Save a list of outputs
save_outputs( outputs, outfolder = file.path("output"), generic_suffix = NULL, save_rds = TRUE, verbose_level = 1 )
save_outputs( outputs, outfolder = file.path("output"), generic_suffix = NULL, save_rds = TRUE, verbose_level = 1 )
outputs |
'list' of outputs as created by 'generate_outputs' |
outfolder |
Folder in which to store the 'outputs“ |
generic_suffix |
generic suffix. must be length 1 character or NULL. |
save_rds |
Should the input 'outputs' be saved as '.rds' files in in addition to '.out' or '.pdf' files? Defaults to 'FALSE'. |
verbose_level |
Level of verbose information displayed. Default set to '1'. |
## As `save_outputs` is the last step in the pipeline we have to run ## the 'whole machinery' in order to show its functionality. Also take a look ## at the `AutoslideR-Demo` repo on code.roche.com. library(dplyr, warn.conflicts = FALSE) data <- list( adsl = eg_adsl, adae = eg_adae, adtte = eg_adtte ) filters::load_filters( yaml_file = system.file("filters.yml", package = "autoslider.core"), overwrite = TRUE ) ## For this example the outputs will be saved in a temporary directory. In a ## production run this should be the reporting event's 'output' folder instead. output_dir <- tempdir() spec_file <- system.file("spec.yml", package = "autoslider.core") read_spec(spec_file) %>% filter_spec(program == "t_dm_slide") %>% generate_outputs(datasets = data) %>% decorate_outputs() %>% save_outputs(outfolder = output_dir)
## As `save_outputs` is the last step in the pipeline we have to run ## the 'whole machinery' in order to show its functionality. Also take a look ## at the `AutoslideR-Demo` repo on code.roche.com. library(dplyr, warn.conflicts = FALSE) data <- list( adsl = eg_adsl, adae = eg_adae, adtte = eg_adtte ) filters::load_filters( yaml_file = system.file("filters.yml", package = "autoslider.core"), overwrite = TRUE ) ## For this example the outputs will be saved in a temporary directory. In a ## production run this should be the reporting event's 'output' folder instead. output_dir <- tempdir() spec_file <- system.file("spec.yml", package = "autoslider.core") read_spec(spec_file) %>% filter_spec(program == "t_dm_slide") %>% generate_outputs(datasets = data) %>% decorate_outputs() %>% save_outputs(outfolder = output_dir)
Generate flextable for preview first page
slides_preview(x)
slides_preview(x)
x |
rtables or data.frame |
# Example 1. preview table library(dplyr) adsl <- eg_adsl t_dm_slide(adsl, "TRT01P", c("SEX", "AGE")) %>% slides_preview()
# Example 1. preview table library(dplyr) adsl <- eg_adsl t_dm_slide(adsl, "TRT01P", c("SEX", "AGE")) %>% slides_preview()
Adverse event table
t_ae_pt_diff_slide( adsl, adae, arm = "TRT01A", cutoff = NA, split_by_study = FALSE, side_by_side = NULL )
t_ae_pt_diff_slide( adsl, adae, arm = "TRT01A", cutoff = NA, split_by_study = FALSE, side_by_side = NULL )
adsl |
ADSL data set, dataframe |
adae |
ADAE data set, dataframe |
arm |
Arm variable, character, "'TRT01A" by default. |
cutoff |
Cutoff threshold |
split_by_study |
Split by study, building structured header for tables |
side_by_side |
"GlobalAsia" or "GlobalAsiaChina" to define the side by side requirement |
rtables object
* Default arm variables are set to '"TRT01A"' for safety output, and '"TRT01P"' for efficacy output
library(dplyr) adsl <- eg_adsl %>% dplyr::mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) adae <- eg_adae %>% dplyr::mutate( TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo")), ATOXGR = AETOXGR ) out <- t_ae_pt_diff_slide(adsl, adae, "TRT01A", 2) print(out) generate_slides(out, paste0(tempdir(), "/ae_diff.pptx"))
library(dplyr) adsl <- eg_adsl %>% dplyr::mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) adae <- eg_adae %>% dplyr::mutate( TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo")), ATOXGR = AETOXGR ) out <- t_ae_pt_diff_slide(adsl, adae, "TRT01A", 2) print(out) generate_slides(out, paste0(tempdir(), "/ae_diff.pptx"))
Adverse event table
t_ae_pt_slide( adsl, adae, arm = "TRT01A", cutoff = NA, prune_by_total = FALSE, split_by_study = FALSE, side_by_side = NULL )
t_ae_pt_slide( adsl, adae, arm = "TRT01A", cutoff = NA, prune_by_total = FALSE, split_by_study = FALSE, side_by_side = NULL )
adsl |
ADSL data set, dataframe |
adae |
ADAE data set, dataframe |
arm |
Arm variable, character, "'TRT01A" by default. |
cutoff |
Cutoff threshold |
prune_by_total |
Prune according total column |
split_by_study |
Split by study, building structured header for tables |
side_by_side |
A logical value indicating whether to display the data side by side. |
rtables object
* Default arm variables are set to '"TRT01A"' for safety output, and '"TRT01P"' for efficacy output
library(dplyr) # Example 1 adsl <- eg_adsl %>% dplyr::mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) adae <- eg_adae %>% dplyr::mutate( TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo")), ATOXGR = AETOXGR ) out <- t_ae_pt_slide(adsl, adae, "TRT01A", 2) print(out) generate_slides(out, "ae.pptx") # Example 2, prune by total column out2 <- t_ae_pt_slide(adsl, adae, "TRT01A", 25, prune_by_total = TRUE) print(out2) generate_slides(out, paste0(tempdir(), "/ae2.pptx"))
library(dplyr) # Example 1 adsl <- eg_adsl %>% dplyr::mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) adae <- eg_adae %>% dplyr::mutate( TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo")), ATOXGR = AETOXGR ) out <- t_ae_pt_slide(adsl, adae, "TRT01A", 2) print(out) generate_slides(out, "ae.pptx") # Example 2, prune by total column out2 <- t_ae_pt_slide(adsl, adae, "TRT01A", 25, prune_by_total = TRUE) print(out2) generate_slides(out, paste0(tempdir(), "/ae2.pptx"))
Adverse event table
t_ae_pt_soc_diff_slide( adsl, adae, arm = "TRT01A", cutoff = NA, split_by_study = FALSE, side_by_side = NULL )
t_ae_pt_soc_diff_slide( adsl, adae, arm = "TRT01A", cutoff = NA, split_by_study = FALSE, side_by_side = NULL )
adsl |
ADSL data set, dataframe |
adae |
ADAE data set, dataframe |
arm |
Arm variable, character, "'TRT01A" by default. |
cutoff |
Cutoff threshold |
split_by_study |
Split by study, building structured header for tables |
side_by_side |
"GlobalAsia" or "GlobalAsiaChina" to define the side by side requirement |
rtables object
* Default arm variables are set to '"TRT01A"' for safety output, and '"TRT01P"' for efficacy output
library(dplyr) adsl <- eg_adsl %>% dplyr::mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) adae <- eg_adae %>% dplyr::mutate( TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo")), ATOXGR = AETOXGR ) out <- t_ae_pt_soc_diff_slide(adsl, adae, "TRT01A", 2) print(out) generate_slides(out, paste0(tempdir(), "/ae_diff.pptx"))
library(dplyr) adsl <- eg_adsl %>% dplyr::mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) adae <- eg_adae %>% dplyr::mutate( TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo")), ATOXGR = AETOXGR ) out <- t_ae_pt_soc_diff_slide(adsl, adae, "TRT01A", 2) print(out) generate_slides(out, paste0(tempdir(), "/ae_diff.pptx"))
Adverse event table
t_ae_pt_soc_slide( adsl, adae, arm, cutoff = NA, prune_by_total = FALSE, split_by_study = FALSE, side_by_side = NULL )
t_ae_pt_soc_slide( adsl, adae, arm, cutoff = NA, prune_by_total = FALSE, split_by_study = FALSE, side_by_side = NULL )
adsl |
ADSL data set, dataframe |
adae |
ADAE data set, dataframe |
arm |
Arm variable, character |
cutoff |
Cutoff threshold |
prune_by_total |
Prune according total column |
split_by_study |
Split by study, building structured header for tables |
side_by_side |
"GlobalAsia" or "GlobalAsiaChina" to define the side by side requirement |
rtables object
library(dplyr) # Example 1 adsl <- eg_adsl %>% dplyr::mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) adae <- eg_adae %>% dplyr::mutate( TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo")), ATOXGR = AETOXGR ) out <- t_ae_pt_soc_slide(adsl, adae, "TRT01A", 2) print(out) generate_slides(out, "ae.pptx") # Example 2, prune by total column out2 <- t_ae_pt_soc_slide(adsl, adae, "TRT01A", 25, prune_by_total = TRUE) print(out2) generate_slides(out2, paste0(tempdir(), "/ae2.pptx"))
library(dplyr) # Example 1 adsl <- eg_adsl %>% dplyr::mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) adae <- eg_adae %>% dplyr::mutate( TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo")), ATOXGR = AETOXGR ) out <- t_ae_pt_soc_slide(adsl, adae, "TRT01A", 2) print(out) generate_slides(out, "ae.pptx") # Example 2, prune by total column out2 <- t_ae_pt_soc_slide(adsl, adae, "TRT01A", 25, prune_by_total = TRUE) print(out2) generate_slides(out2, paste0(tempdir(), "/ae2.pptx"))
Adverse event table
t_ae_slide( adsl, adae, arm = "TRT01A", split_by_study = FALSE, side_by_side = NULL )
t_ae_slide( adsl, adae, arm = "TRT01A", split_by_study = FALSE, side_by_side = NULL )
adsl |
ADSL data set, dataframe |
adae |
ADAE data set, dataframe |
arm |
Arm variable, character, "'TRT01A" by default. |
split_by_study |
Split by study, building structured header for tables |
side_by_side |
should table be displayed side by side |
rtables object
* Default arm variables are set to '"TRT01A"' for safety output, and '"TRT01P"' for efficacy output
library(dplyr) adsl <- eg_adsl %>% dplyr::mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) adae <- eg_adae %>% dplyr::mutate( TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo")), ATOXGR = AETOXGR ) out <- t_ae_slide(adsl, adae, "TRT01A") print(out) generate_slides(out, paste0(tempdir(), "/ae.pptx"))
library(dplyr) adsl <- eg_adsl %>% dplyr::mutate(TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo"))) adae <- eg_adae %>% dplyr::mutate( TRT01A = factor(TRT01A, levels = c("A: Drug X", "B: Placebo")), ATOXGR = AETOXGR ) out <- t_ae_slide(adsl, adae, "TRT01A") print(out) generate_slides(out, paste0(tempdir(), "/ae.pptx"))
Adverse event summary table
t_ae_summ_slide( adsl, adae, arm = "TRT01A", dose_adjust_flags = NA, dose_adjust_labels = NA, gr34_highest_grade_only = TRUE )
t_ae_summ_slide( adsl, adae, arm = "TRT01A", dose_adjust_flags = NA, dose_adjust_labels = NA, gr34_highest_grade_only = TRUE )
adsl |
ADSL dataset, dataframe |
adae |
ADAE dataset, dataframe |
arm |
Arm variable, character, "'TRT01A" by default. |
dose_adjust_flags |
Character or a vector of characters. Each character is a variable name in adae dataset. These variables are Logical vectors which flag AEs leading to dose adjustment, such as drug discontinuation, dose interruption and reduction. The flag can be related to any drug, or a specific drug. |
dose_adjust_labels |
Character or a vector of characters. Each character represents
a label displayed in the AE summary table (e.g. AE leading to discontinuation
from drug X). The order of the labels should match the order of variable
names in |
gr34_highest_grade_only |
A logical value. Default is TRUE, such that only patients with the highest AE grade as 3 or 4 are included for the count of the "Grade 3-4 AE" and "Treatment-related Grade 3-4 AE" ; set it to FALSE if you want to include patients with the highest AE grade as 5. |
an rtables object
library(dplyr) ADSL <- eg_adsl ADAE <- eg_adae ADAE <- ADAE %>% dplyr::mutate(ATOXGR = AETOXGR) t_ae_summ_slide(adsl = ADSL, adae = ADAE) # add flag for ae leading to dose reduction ADAE$reduce_flg <- ifelse(ADAE$AEACN == "DOSE REDUCED", TRUE, FALSE) t_ae_summ_slide( adsl = ADSL, adae = ADAE, dose_adjust_flags = c("reduce_flg"), dose_adjust_labels = c("AE leading to dose reduction of drug X") ) # add flgs for ae leading to dose reduction, drug withdraw and drug interruption ADAE$withdraw_flg <- ifelse(ADAE$AEACN == "DRUG WITHDRAWN", TRUE, FALSE) ADAE$interrup_flg <- ifelse(ADAE$AEACN == "DRUG INTERRUPTED", TRUE, FALSE) out <- t_ae_summ_slide( adsl = ADSL, adae = ADAE, arm = "TRT01A", dose_adjust_flags = c("withdraw_flg", "reduce_flg", "interrup_flg"), dose_adjust_labels = c( "AE leading to discontinuation from drug X", "AE leading to drug X reduction", "AE leading to drug X interruption" ) ) print(out) generate_slides(out, paste0(tempdir(), "/ae_summary.pptx"))
library(dplyr) ADSL <- eg_adsl ADAE <- eg_adae ADAE <- ADAE %>% dplyr::mutate(ATOXGR = AETOXGR) t_ae_summ_slide(adsl = ADSL, adae = ADAE) # add flag for ae leading to dose reduction ADAE$reduce_flg <- ifelse(ADAE$AEACN == "DOSE REDUCED", TRUE, FALSE) t_ae_summ_slide( adsl = ADSL, adae = ADAE, dose_adjust_flags = c("reduce_flg"), dose_adjust_labels = c("AE leading to dose reduction of drug X") ) # add flgs for ae leading to dose reduction, drug withdraw and drug interruption ADAE$withdraw_flg <- ifelse(ADAE$AEACN == "DRUG WITHDRAWN", TRUE, FALSE) ADAE$interrup_flg <- ifelse(ADAE$AEACN == "DRUG INTERRUPTED", TRUE, FALSE) out <- t_ae_summ_slide( adsl = ADSL, adae = ADAE, arm = "TRT01A", dose_adjust_flags = c("withdraw_flg", "reduce_flg", "interrup_flg"), dose_adjust_labels = c( "AE leading to discontinuation from drug X", "AE leading to drug X reduction", "AE leading to drug X interruption" ) ) print(out) generate_slides(out, paste0(tempdir(), "/ae_summary.pptx"))
Table of AEs of Special Interest adapted from https://insightsengineering.github.io/tlg-catalog/stable/tables/adverse-events/aet01_aesi.html
t_aesi_slide(adsl, adae, aesi, arm = "ACTARM", grad_var = "AETOXGR")
t_aesi_slide(adsl, adae, aesi, arm = "ACTARM", grad_var = "AETOXGR")
adsl |
ADSL data set, dataframe |
adae |
ADAE data set, dataframe. |
aesi |
AESI variable which will act as a filter to select the rows required to create the table. An example of AESI variable is CQ01NAM. |
arm |
Arm variable, character, '"ACTARM"' by default. |
grad_var |
Grading variable, character, '"AETOXGR"' by default. |
rtables object
Kai Xiang Lim ('limk43')
library(dplyr) adsl <- eg_adsl adae <- eg_adae adae_atoxgr <- adae %>% dplyr::mutate(ATOXGR = AETOXGR) t_aesi_slide(adsl, adae, aesi = "CQ01NAM") t_aesi_slide(adsl, adae, aesi = "CQ01NAM", arm = "ARM", grad_var = "AESEV") t_aesi_slide(adsl, adae_atoxgr, aesi = "CQ01NAM", grad_var = "ATOXGR")
library(dplyr) adsl <- eg_adsl adae <- eg_adae adae_atoxgr <- adae %>% dplyr::mutate(ATOXGR = AETOXGR) t_aesi_slide(adsl, adae, aesi = "CQ01NAM") t_aesi_slide(adsl, adae, aesi = "CQ01NAM", arm = "ARM", grad_var = "AESEV") t_aesi_slide(adsl, adae_atoxgr, aesi = "CQ01NAM", grad_var = "ATOXGR")
Death table
t_dd_slide(adsl, arm = "TRT01A", split_by_study = FALSE, side_by_side = NULL)
t_dd_slide(adsl, arm = "TRT01A", split_by_study = FALSE, side_by_side = NULL)
adsl |
ADSL data set, dataframe |
arm |
Arm variable, character, "'TRT01A" by default. |
split_by_study |
Split by study, building structured header for tables |
side_by_side |
used for studies in China. "GlobalAsia" or "GlobalAsiaChina" to define the side by side requirement. |
rtables object
* Default arm variables are set to '"TRT01A"' for safety output, and '"TRT01P"' for efficacy output
library(dplyr) adsl <- eg_adsl %>% preprocess_t_dd() out1 <- t_dd_slide(adsl, "TRT01A") print(out1) generate_slides(out1, paste0(tempdir(), "/dd.pptx")) out2 <- t_dd_slide(adsl, "TRT01A", split_by_study = TRUE) print(out2)
library(dplyr) adsl <- eg_adsl %>% preprocess_t_dd() out1 <- t_dd_slide(adsl, "TRT01A") print(out1) generate_slides(out1, paste0(tempdir(), "/dd.pptx")) out2 <- t_dd_slide(adsl, "TRT01A", split_by_study = TRUE) print(out2)
Demographic table
t_dm_slide( adsl, arm = "TRT01P", vars = c("AGE", "SEX", "RACE"), stats = c("median", "range", "count_fraction"), split_by_study = FALSE, side_by_side = NULL )
t_dm_slide( adsl, arm = "TRT01P", vars = c("AGE", "SEX", "RACE"), stats = c("median", "range", "count_fraction"), split_by_study = FALSE, side_by_side = NULL )
adsl |
ADSL data set, dataframe |
arm |
Arm variable, character, "'TRT01P" by default. |
vars |
Characters of variables |
stats |
see '.stats' from [tern::analyze_vars()] |
split_by_study |
Split by study, building structured header for tables |
side_by_side |
"GlobalAsia" or "GlobalAsiaChina" to define the side by side requirement |
rtables object
* Default arm variables are set to '"TRT01A"' for safety output, and '"TRT01P"' for efficacy output
library(dplyr) adsl <- eg_adsl out1 <- t_dm_slide(adsl, "TRT01P", c("SEX", "AGE", "RACE", "ETHNIC", "COUNTRY")) print(out1) generate_slides(out1, paste0(tempdir(), "/dm.pptx")) out2 <- t_dm_slide(adsl, "TRT01P", c("SEX", "AGE", "RACE", "ETHNIC", "COUNTRY"), split_by_study = TRUE ) print(out2)
library(dplyr) adsl <- eg_adsl out1 <- t_dm_slide(adsl, "TRT01P", c("SEX", "AGE", "RACE", "ETHNIC", "COUNTRY")) print(out1) generate_slides(out1, paste0(tempdir(), "/dm.pptx")) out2 <- t_dm_slide(adsl, "TRT01P", c("SEX", "AGE", "RACE", "ETHNIC", "COUNTRY"), split_by_study = TRUE ) print(out2)
DOR table
t_dor_slide(adsl, adtte, arm = "TRT01P", refgroup = NULL)
t_dor_slide(adsl, adtte, arm = "TRT01P", refgroup = NULL)
adsl |
ADSL dataset |
adtte |
ADTTE dataset |
arm |
Arm variable, character, "'TRT01P" by default. |
refgroup |
Reference group |
* Default arm variables are set to '"TRT01A"' for safety output, and '"TRT01P"' for efficacy output
library(dplyr) adsl <- eg_adsl %>% dplyr::mutate(TRT01P = factor(TRT01P, levels = c("A: Drug X", "B: Placebo", "C: Combination"))) adtte <- eg_adtte %>% dplyr::filter(PARAMCD == "OS") %>% dplyr::mutate(TRT01P = factor(TRT01P, levels = c("A: Drug X", "B: Placebo", "C: Combination"))) out <- t_dor_slide(adsl, adtte) print(out) generate_slides(out, paste0(tempdir(), "/dor.pptx"))
library(dplyr) adsl <- eg_adsl %>% dplyr::mutate(TRT01P = factor(TRT01P, levels = c("A: Drug X", "B: Placebo", "C: Combination"))) adtte <- eg_adtte %>% dplyr::filter(PARAMCD == "OS") %>% dplyr::mutate(TRT01P = factor(TRT01P, levels = c("A: Drug X", "B: Placebo", "C: Combination"))) out <- t_dor_slide(adsl, adtte) print(out) generate_slides(out, paste0(tempdir(), "/dor.pptx"))
Add decorated flextable to slides
table_to_slide( ppt, content, decor = TRUE, table_loc = ph_location_type("body"), ... )
table_to_slide( ppt, content, decor = TRUE, table_loc = ph_location_type("body"), ... )
ppt |
Slide |
content |
Content to be added |
decor |
Should table be decorated |
table_loc |
Table location |
... |
additional arguments |
Slide with added content
Convert list of numbers to vectors
to_vector(num_list)
to_vector(num_list)
num_list |
list of numbers |
Format of xx.xx (xx.x)
trim_perc(x, output)
trim_perc(x, output)
x |
input array |
output |
output handle |
Format of xx.xx (xx.xx)
trim_perc1(x, output)
trim_perc1(x, output)
x |
input array |
output |
output handle |