Skip to contents

This function uses stata_expand and dplyr::mutate to give a data frame that, when summarised, with give total rows and/or columns.

Usage

totals(df = ., ..., name = "Total")

Arguments

df

A data frame

...

one or two columns for which we require totals

name

Character string for the name of the total row/column

Examples

    df <- totals(mtcars, cyl)
    dplyr::count(df)
#>    n
#> 1 64