flatten_args: Flatten list of tibble objects into a single tibble

View source: R/list_xtab_args.R

flatten_argsR Documentation

Flatten list of tibble objects into a single tibble

Description

This is a helper function that accepts the output of list_xtab_args() or list_xtab_3way_args() 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 arguments, which can then be passed to generate_tbls() or ft_generate_tbls().

Usage

flatten_args(l)

Arguments

l

A list of lists as returned by list_xtab_args() or list_xtab_3way_args().

Value

A single tibble of crosstab arguments to be passed to generate_tbls(type = "crosstab_2way") or generate_tbls(type = "crosstab_3way").

See Also

list_xtab_args() and list_xtab_3way_args() for vectorized crosstab arguments generation and generate_tbls() for multiple tables generation.

Examples


# Generate arguments list for crosstabs
list_xtabs_args(df, var_of_interest, dependent_vars, rm) %>%
  flatten_args(l = .)

# Generate arguments list for three-way crosstabs
list_xtabs_args(df, control_var, independent_vars, dependent_vars) %>%
  flatten_args(l = .)


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