Adds Subtotals to Data Reports

Adds subtotal rows / sections (a la the 'SAS' 'Proc Tabulate' All option) to a Group By output by running a series of Group By functions with partial sets of the same variables and combining the results with the original. Can be used to add comprehensive information to a data report or to quickly aggregate Group By outputs used to gain a greater understanding of data.


The goal of ReportSubtotal is to adds subtotal rows / sections (a la SAS's Proc Tabulate) to a Group By output.

Installation

You can install the released version of ReportSubtotal from CRAN with:

install.packages("ReportSubtotal")

Example

This is a basic example which shows you how to solve a common problem:

library(dplyr)
library(ReportSubtotal)

group_by(iris, Species, Petal.Width) %>%
summarise(Mean_Width = mean(Sepal.Width), .groups = "keep") %>%
subtotal_row(iris, vars = "Sepal.Width", aggregator = "mean")

group_by(mtcars, cyl, gear, carb) %>%
summarise(Med_Wt = median(wt), Med_Hp = median(hp), .groups = "keep") %>%
subtotal_row(mtcars, vars = c("wt", "hp"), aggregator = "median")

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("ReportSubtotal")

0.2.1 by Yoni Aboody, 2 months ago


Browse source code at https://github.com/cran/ReportSubtotal


Authors: Yoni Aboody [aut, cre, cph]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports dplyr, tidyselect, utils, magrittr, rlang, lubridate

Suggests bench, testthat, tidyverse, devtools, ggplot2


See at CRAN