Learn R Programming

qol (version 1.2.1)

expand_formats: Expand A List Of Formats To Generate All Possible Combinations

Description

Generates a data frame which contains all nested combinations of the provided format labels.

Usage

expand_formats(..., names = NULL)

Value

Returns a data frames with all format label combinations.

Arguments

...

A list containing format data frames.

names

Custom variable names for the newly generated data frame.

Examples

Run this code
# Example formats
sex. <- discrete_format(
    "Total"  = 1:2,
    "Male"   = 1,
    "Female" = 2)

age. <- discrete_format(
    "Total"          = 0:100,
    "under 18"       = 0:17,
    "18 to under 25" = 18:24,
    "25 to under 55" = 25:54,
    "55 to under 65" = 55:64,
    "65 and older"   = 65:100)

# Expand formats
expand_df <- expand_formats(sex., age.,
                            names = c("sex", "age"))

Run the code above in your browser using DataLab