Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
edelarua committed Nov 22, 2023
1 parent 9856a99 commit 7b9b732
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
20 changes: 9 additions & 11 deletions R/utils_ggplot.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#' Convert `rtable` object to `ggplot` object
#'
#' Given a [rtables::rtable()] object, performs basic conversion to a `ggplot` object built using
#' 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.
#'
#' @param tbl (`rtable`)\cr a [rtables::rtable()] object.
#' @param tbl (`rtable`)\cr a `rtable` object.
#' @param fontsize (`numeric`)\cr font size.
#' @param colwidths (`vector` of `numeric`)\cr a vector of column widths. Each element's position in
#' `colwidths` corresponds to the column of `tbl` in the same position. If `NULL`, column widths
Expand All @@ -16,10 +16,8 @@
#'
#' @examples
#' dta <- data.frame(
#' USUBJID = rep(1:6, each = 3),
#' PARAMCD = rep("lab", 6 * 3),
#' AVISIT = rep(paste0("V", 1:3), 6),
#' ARM = rep(LETTERS[1:3], rep(6, 3)),
#' AVISIT = rep(paste0("V", 1:3), 6),
#' AVAL = c(9:1, rep(NA, 9))
#' )
#'
Expand All @@ -36,12 +34,12 @@
#'
#' @export
rtable2gg <- function(tbl, fontsize = 4, colwidths = NULL, lbl_col_padding = 0) {
mat <- matrix_form(tbl)
mat_strings <- mf_strings(mat)
mat_aligns <- mf_aligns(mat)
mat_indent <- mf_rinfo(mat)$indent
mat_display <- mf_display(mat)
nlines_hdr <- mf_nlheader(mat)
mat <- rtables::matrix_form(tbl)
mat_strings <- rtables::mf_strings(mat)
mat_aligns <- rtables::mf_aligns(mat)
mat_indent <- rtables::mf_rinfo(mat)$indent
mat_display <- rtables::mf_display(mat)
nlines_hdr <- rtables::mf_nlheader(mat)
shared_hdr_rows <- which(apply(mat_display, 1, function(x) (any(!x))))

tbl_df <- data.frame(mat_strings)
Expand Down
8 changes: 3 additions & 5 deletions man/rtable2gg.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7b9b732

Please sign in to comment.