Description Usage Arguments Examples
add a averages summary row to a data frame. This is a wrapper around the summary_row
function.
1 2 |
df |
the data frame |
cols |
numeric vector of columns to include in the summary row |
rows |
numeric vector of rows to include in summary calculation. By default
|
label_col |
column number to hold the summary row label specified by
the |
label |
summary row label. defaults to "Averages" |
new_row |
boolean value indicating whether the summary row should be a new row attached to the bottom of the data frame or if it should be combined with an already existing summary row. |
fill |
value to insert in columns not specified in the |
1 2 3 4 5 6 7 8 9 10 11 12 | df <- data.frame("year" = 2014:2016,
"a" = c(NA, 1, 3),
"b" = c("g", "e", "f")
)
averages_row(df = df, cols = 2)
averages_row(df = df, cols = 2, label_col = 1, label = "Totals")
df$d <- 5:7
# add new row
averages_row(df = df, cols = c(2, 4), label_col = 1, label = "Totals")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.