powered by
Add a column total
add_column_total(data, label_total = "Total", ...)
The input data frame with an additional column representing the total of each row.
A data frame, tibble, or tsg object to which a column row will be added.
tsg
Label for the total column. Default is "Total".
Additional named arguments to be added as columns alongside the total column.
# Example data frame df <- data.frame( category = c("A", "B", "C"), value1 = c(10, 20, 30), value2 = c(5, 15, 25) ) add_column_total(df)
Run the code above in your browser using DataLab