Given a rtables::rtable() object, performs basic conversion to a ggplot2::ggplot() object built using
functions from the ggplot2 package. Any table titles and/or footnotes are ignored.
Arguments
- tbl
 (
VTableTree)rtablestable object.- fontsize
 (
numeric(1))
font size.- colwidths
 (
numericorNULL)
a vector of column widths. Each element's position incolwidthscorresponds to the column oftblin the same position. IfNULL, column widths are calculated according to maximum number of characters per column.- lbl_col_padding
 (
numeric)
additional padding to use when calculating spacing between the first (label) column and the second column oftbl. Ifcolwidthsis specified, the width of the first column becomescolwidths[1] + lbl_col_padding. Defaults to 0.
Examples
dta <- data.frame(
  ARM     = rep(LETTERS[1:3], rep(6, 3)),
  AVISIT  = rep(paste0("V", 1:3), 6),
  AVAL    = c(9:1, rep(NA, 9))
)
lyt <- basic_table() %>%
  split_cols_by(var = "ARM") %>%
  split_rows_by(var = "AVISIT") %>%
  analyze_vars(vars = "AVAL")
tbl <- build_table(lyt, df = dta)
rtable2gg(tbl)
rtable2gg(tbl, fontsize = 15, colwidths = c(2, 1, 1, 1))
