data.frame_export {rtables} | R Documentation |
Generate a result data frame
Description
Collection of utilities to extract data.frame
objects from TableTree
objects.
Usage
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,
...
)
path_enriched_df(tt, path_fun = collapse_path, value_fun = collapse_values)
Arguments
tt |
( |
spec |
( |
data_format |
( |
make_ard |
( |
expand_colnames |
( |
keep_label_rows |
( |
add_tbl_name_split |
( |
simplify |
( |
verbose |
( |
... |
additional arguments passed to spec-specific result data frame function ( |
path_fun |
( |
value_fun |
( |
Value
-
as_result_df
returns a resultdata.frame
.
-
path_enriched_df()
returns adata.frame
oftt
's cell values (processed byvalue_fun
, with columns named by the full column paths (processed bypath_fun
and an additionalrow_path
column with the row paths (processed bypath_fun
).
Functions
-
path_enriched_df()
: Transform aTableTree
object to a path-enricheddata.frame
.
Note
When parent_name
is used when constructing a layout to directly control
the name of subtables in a table, that will be reflected in the 'group' values
returned in the result dataframe/ard. When automatic de-duplication of sibling names
is performed by rtables
, that is automatically undone during the result
df creation process, so the group values will be as if the relevant siblings
had identical names.
See Also
df_to_tt()
when using simplify = TRUE
and formatters::make_row_df()
to have a
comprehensive view of the hierarchical structure of the rows.
Examples
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)