totals: Mutates data frame so that summary tables give totals

View source: R/totals.R

totalsR Documentation

Mutates data frame so that summary tables give totals

Description

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)


EstherHerbert/Useful.functions documentation built on Jan. 31, 2025, 10:41 a.m.