I apologize but I am unsure of how to word this. I am using Rmarkdown and DT to make many tables and I am hoping to not have to manually set which rows to group. I am making tables of sales by region where USA is the total for all districts from data.frame$district and NY and NJ are the individual districts. I would essentially like to make the first table into the second one in my HTML output
.
I came across flextable but it is making me specify which positions to group, and I would prefer to automate this by using some sort of group_at(location) and I lose the ability to allow people to download the table output from DT. The other problem is USA is not actually an option in data.frame$district and it is just the manual entry for total. Should I start by creating a new grouping variable first?