Description Usage Arguments Details Value Examples
Adding margins to column, row or both, non-numeric columns are ignored.Use
argument ingnoreCols
to skip numeric columns.
1 2 3 4 5 6 7 8 9 10 |
df |
data frame to add margin to. |
margin |
valid values are "column", "row", "both". Append margins after column, row or both. |
verbose |
show or hide messages |
enable_total_margin |
default to |
direction_total_margin, |
default to "column", direction for calculating total margin, please read more in details. |
fun.aggregate |
function used to calculate margin, default to sum, can be one of min, max, median, sd, sum, mean or any other custom functions which can reduce a column/row automatically enabled. |
... |
other arguments passed to aggregate function |
ingnoreCols |
numeric columns to ignore when adding margin, can use column names or column indexes. |
when direction
is set to "both", total margin on bottom right of the
data frame may not make sense when using mean, sd or similar functions as
aggregating fucntion.
To specify direction of calculation:
direction_total_margin = "column"
to calculate by columns(horizontally),
direction_total_margin = "row"
to calculate by rows(vertically)
A data frame with extra an extra column/row as the total for that column/row
1 2 3 4 5 6 7 8 9 10 | du_add_margin(iris)
du_add_margin(iris,verbose = FALSE)
du_add_margin(iris,fun.aggregate=mean,na.rm = TRUE)
# disable calculation for total margin
du_add_margin(
iris,
enable_total_margin = FALSE,
fun.aggregate=sd,
na.rm = TRUE
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.