powered by
Add row and/or column summaries (e.g., total counts) to a data frame.
append_summary(df, ..., row = TRUE, col = TRUE, .f = sum, args = NULL)
A data frame with the summary row and/or column appended
A data frame to append summaries to.
Unquoted names of columns to be included in the summary
logical indicating whether a summary row should be added (i.e., summarizing each column)
logical indicating whether a summary column should be added (i.e., summarizing each row)
Function to use for calculating summaries
A named list of arguments to pass to .f
.f
set.seed(9416) df <- tibble::tibble(char = letters[1:5], x = rnorm(5), y = rnorm(5)) append_summary(df, x, y, row = TRUE, col = TRUE, .f = sum) append_summary(df, x, y, row = FALSE, .f = mean)
Run the code above in your browser using DataLab