Learn R Programming

rtables (version 0.5.1)

tostring: Convert an rtable object to a string

Description

Convert an rtable object to a string

Usage

# S4 method for VTableTree
toString(
  x,
  widths = NULL,
  col_gap = 3,
  hsep = horizontal_sep(x),
  indent_size = 2
)

Value

a string representation of x as it appears when printed.

Arguments

x

table object

widths

widths of row.name and columns columns

col_gap

gap between columns

hsep

character to create line separator

indent_size

numeric(1). Number of spaces to use per indent level. Defaults to 2

Examples

Run this code
library(dplyr)

iris2 <- iris %>%
  group_by(Species) %>%
  mutate(group = as.factor(rep_len(c("a", "b"), length.out = n()))) %>%
  ungroup()

l <- basic_table() %>%
  split_cols_by("Species") %>%
  split_cols_by("group") %>%
  analyze(c("Sepal.Length", "Petal.Width"), afun = list_wrap_x(summary) , format = "xx.xx")

tbl <- build_table(l, iris2)

cat(toString(tbl, col_gap = 3))

Run the code above in your browser using DataLab