Collection of utilities to extract data.frame objects from TableTree objects.
as_result_df(
tt,
spec = NULL,
data_format = c("full_precision", "strings", "numeric"),
make_ard = FALSE,
expand_colnames = FALSE,
keep_label_rows = FALSE,
add_tbl_name_split = FALSE,
simplify = FALSE,
verbose = FALSE,
round_type = obj_round_type(tt),
...
)path_enriched_df(tt, path_fun = collapse_path, value_fun = collapse_values)
as_result_df returns a result data.frame.
path_enriched_df() returns a data.frame of tt's cell values (processed by value_fun, with columns named by
the full column paths (processed by path_fun and an additional row_path column with the row paths (processed
by path_fun).
(TableTree or related class)
a TableTree object representing a populated table.
(function)
function that generates the result data frame from a table (TableTree).
It defaults to NULL, for standard processing.
(string)
the format of the data in the result data frame. It can be one value
between "full_precision" (default), "strings", and "numeric". The last two values show the numeric
data with the visible precision.
(flag)
when TRUE, the result data frame will have only one statistic per row.
(flag)
when TRUE, the result data frame will have expanded column
names above the usual output. This is useful when the result data frame is used for further processing.
(flag)
when TRUE, the result data frame will have all labels
as they appear in the final table.
(flag)
when TRUE and when the table has more than one
analyze(table_names = "<diff_names>"), the table names will be present as a group split named
"<analysis_spl_tbl_name>".
(flag)
when TRUE, the result data frame will have only visible labels and
result columns. Consider showing also label rows with keep_label_rows = TRUE. This output can be
used again to create a TableTree object with df_to_tt().
(flag)
when TRUE, the function will print additional information for
data_format != "full_precision".
("iec" (default), "iec_mod" or "sas")
the type of rounding to perform.
See formatters::format_value() for details.
additional arguments passed to spec-specific result data frame function (spec). When
using make_ard = TRUE, it is possible to turn off the extraction of the exact string decimals
printed by the table with add_tbl_str_decimals = FALSE.
(function)
function to transform paths into single-string row/column names.
(function)
function to transform cell values into cells of a data.frame. Defaults to
collapse_values, which creates strings where multi-valued cells are collapsed together, separated by |.
path_enriched_df(): Transform a TableTree object to a path-enriched data.frame.
df_to_tt() when using simplify = TRUE and formatters::make_row_df() to have a
comprehensive view of the hierarchical structure of the rows.
lyt <- basic_table() %>%
split_cols_by("ARM") %>%
split_rows_by("STRATA1") %>%
analyze(c("AGE", "BMRKR2"))
tbl <- build_table(lyt, ex_adsl)
as_result_df(tbl, simplify = TRUE)
lyt <- basic_table() %>%
split_cols_by("ARM") %>%
analyze(c("AGE", "BMRKR2"))
tbl <- build_table(lyt, ex_adsl)
path_enriched_df(tbl)
Run the code above in your browser using DataLab