I'd suspect that there isn't really a tidyverse way to do this because your resulting data frame isn't very 'tidyverse'.
As a report I think your summary table can be great, simply because your audience understands and it ma hold exactly the information that they need. However as a table it isn't very tidy. Specifically the 'Name' column, it is a variable indicating a store and 'total' and 'grand total' are not stores. Since the tidyvese functions generally take a tidy data frame and return a tidy data frame I doubt that there is any mainstream functions that do this.
If you need this a lot you could write your own function and pipe your data through it.
salesData <- data.frame(District=as.character(c(1,1,1,2,2,2)),
Name=c("S1","S2","S3","S4","S5","S6"),
NetSales=c(1000,1500,3000,2000,1500,3000),
Units=c(50,120,52,12,64,52)) %>%
mutate(AUR = NetSales / Units)
report_salesdata <- function(salesdata) {
salesdata %>%
bind_rows(salesData %>%
group_by(District) %>%
summarize(Name = "Total",
NetSales = sum(NetSales),
Units = sum(Units),
AUR = sum(NetSales) / sum(Units) )
) %>%
arrange(District, Name) %>%
bind_rows(salesData %>%
summarize(
District = "",
Name = "GrandTotal",
NetSales = sum(NetSales),
Units = sum(Units),
AUR = round(sum(NetSales)/sum(Units),2))
)
}
salesData %>%
report_salesdata() %>%
xtable()
Best,
Jiddu