Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

pxmake (version 0.17.0)

add_totals_to_df: Add total levels to multiple variables

Description

Wrapper around add_total_level_to_var to add levels to total level to multiple variables.

Usage

add_totals_to_df(df, variables, level_names, sum_var = "value", na.rm = TRUE)

Arguments

df

Data frame to add total levels to.

variables

List of variables to add total levels to.

level_names

Names of total levels. Should have length 1 or same length as variables.

sum_var

String, name of variable to sum over.

na.rm

Optional. Logical. If TRUE, NAs are removed before summing.