View source: R/misc-manipulation.R
append_summary | R Documentation |
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)
df |
A data frame to append summaries to. |
... |
Unquoted names of columns to be included in the summary |
row |
logical indicating whether a summary row should be added (i.e., summarizing each column) |
col |
logical indicating whether a summary column should be added (i.e., summarizing each row) |
.f |
Function to use for calculating summaries |
args |
A named list of arguments to pass to |
A data frame with the summary row and/or column appended
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.