append_summary {ratlas} | R Documentation |
Append row and/or column summaries
Description
Add row and/or column summaries (e.g., total counts) to a data frame.
Usage
append_summary(df, ..., row = TRUE, col = TRUE, .f = sum, args = NULL)
Arguments
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 |
Value
A data frame with the summary row and/or column appended
Examples
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)
[Package ratlas version 0.1.0 Index]