combine_topline_multiselect: Combine the results of 'apply_topline_multiselect()'

View source: R/combine_topline_multiselect.R

combine_topline_multiselectR Documentation

Combine the results of apply_topline_multiselect()

Description

This function completes the split-apply-combine workflow in handling multiple selection questions in the survey. This is a helper function that accepts the output of apply_topline_multiselect() containing two lists— return and error. It will either 1) throw an error indicating that attention must be paid to the error list, or 2) return a single list of toplines, which can then be passed to print_tbls().

Usage

combine_topline_multiselect(l)

Arguments

l

A list of lists as returned by apply_topline_multiselect().

Value

A list of flextable objects.

Examples


# Vector of patterns
patterns <- c("prefix_1", "predix_2", ...)

# List of data.tables
list_df <- split_df(df, patterns, "weight_var")

# Apply topline generation to each element of 'list_df'
captions <- list(c("caption_parent", "caption_child"), "caption_2", ...)
parents <- c(TRUE, FALSE, ...)
results <- apply_topline_multiselect(list_df, "weight_var", captions, parents)

# Combine the results
list_of_toplines <- combine_topline_multiselect(l = results)


YangWu1227/citizenr documentation built on June 18, 2022, 12:17 p.m.