adorn_totals | R Documentation |
This function defaults to excluding the first column of the input data.frame,
assuming that it contains a descriptive variable, but this can be overridden
by specifying the columns to be totaled in the ...
argument. Non-numeric
columns are converted to character class and have a user-specified fill character
inserted in the totals row.
adorn_totals(dat, where = "row", fill = "-", na.rm = TRUE, name = "Total", ...)
dat |
An input |
where |
One of "row", "col", or |
fill |
If there are non-numeric columns, what should fill the bottom row
of those columns? If a string, relevant columns will be coerced to character.
If |
na.rm |
Should missing values (including |
name |
Name of the totals row and/or column. If both are created, and
|
... |
Columns to total. This takes a tidyselect specification. By default,
all numeric columns (besides the initial column, if numeric) are included in
the totals, but this allows you to manually specify which columns should be
included, for use on a data.frame that does not result from a call to |
A data.frame
augmented with a totals row, column, or both.
The data.frame
is now also of class tabyl
and stores information about
the attached totals and underlying data in the tabyl attributes.
mtcars %>%
tabyl(am, cyl) %>%
adorn_totals()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.