make_split_result: Construct split result object

View source: R/make_split_fun.R

make_split_resultR Documentation

Construct split result object

Description

These functions can be used to create or add to a split result in functions which implement core splitting or post-processing within a custom split function.

Usage

make_split_result(values, datasplit, labels, extras = NULL)

add_to_split_result(splres, values, datasplit, labels, extras = NULL)

Arguments

values

(character or list(SplitValue))
the values associated with each facet.

datasplit

(list(data.frame))
the facet data for each facet generated in the split.

labels

(character)
the labels associated with each facet.

extras

(list or NULL)
extra values associated with each of the facets which will be passed to analysis functions applied within the facet.

splres

(list)
a list representing the result of splitting.

Details

These functions performs various housekeeping tasks to ensure that the split result list is as the rtables internals expect it, most of which are not relevant to end users.

Value

A named list representing the facets generated by the split with elements values, datasplit, and labels, which are the same length and correspond to each other element-wise.

See Also

Other make_custom_split: add_combo_facet(), drop_facet_levels(), make_split_fun(), trim_levels_in_facets()

Examples

splres <- make_split_result(
  values = c("hi", "lo"),
  datasplit = list(hi = mtcars, lo = mtcars[1:10, ]),
  labels = c("more data", "less data")
)

splres2 <- add_to_split_result(splres,
  values = "med",
  datasplit = list(med = mtcars[1:20, ]),
  labels = "kinda some data"
)


Roche/rtables documentation built on April 30, 2024, 11:18 p.m.