Add summary area to grid
Arguments
- grid
A table created with
datagrid()
.- columns
Name of column (variable name) for which to add a summary.
- stat
Statistic to display:
"sum"
,"min"
,"max"
or"avg"
. Can be several values.- digits
Number of digits to display.
- label
Label to display next to statistic.
- sep
Separator between several statistics.
- position
The position of the summary area:
"bottom"
or"top"
.- height
The height of the summary area.
- js_function
JavaScript function to compute the statistic you want. Function should have one argument, it will be the values of the column. If used,
stat
,digits
,label
andsep
will be ignored.
Examples
library(toastui)
# Add a line with sum of column
datagrid(ps3_games[, c(1, 5, 6, 7, 8)], colwidths = "guess") %>%
grid_summary(
column = "NA_Sales",
stat = "sum"
)
# Do that for several columns
datagrid(ps3_games[, c(1, 5, 6, 7, 8)], colwidths = "guess") %>%
grid_summary(
column = c("NA_Sales", "EU_Sales", "JP_Sales", "Other_Sales"),
stat = "sum",
label = "Total: "
)