tbl <- basic_table() %>%
split_cols_by("ARM") %>%
split_rows_by("RACE") %>%
analyze("AGE", function(x) {
list(
"mean (sd)" = rcell(c(mean(x), sd(x)), format = "xx.x (xx.x)"),
"n" = length(x),
"frac" = rcell(c(0.1, 0.1), format = "xx (xx)")
)
}) %>%
build_table(tern_ex_adsl) %>%
prune_table()
tree_row_elem <- collect_leaves(tbl[2, ])[[1]]
result <- max(h_row_first_values(tree_row_elem))
result
# Row counts (integer values)
# h_row_counts(tree_row_elem) # Fails because there are no integers
# Using values with integers
tree_row_elem <- collect_leaves(tbl[3, ])[[1]]
result <- h_row_counts(tree_row_elem)
# result
# Row fractions
tree_row_elem <- collect_leaves(tbl[4, ])[[1]]
h_row_fractions(tree_row_elem)
Run the code above in your browser using DataLab