Control if the totals will display when printed
pivot_totals(.data, include_column_totals = TRUE, include_row_totals = TRUE)
.data | A data.frame or a pivot_prep object |
---|---|
include_column_totals | Indicates if the column totals are included in the pivot table |
include_row_totals | Indicates if the row totals are included in the pivot table |
retail_orders %>% pivot_rows(status, country) %>% pivot_values(n()) %>% pivot_totals(include_row_totals = FALSE)#> n() #> Cancelled Spain 1 #> Sweden 1 #> UK 1 #> USA 1 #> Disputed Australia 1 #> Denmark 1 #> Spain 1 #> In Process Australia 1 #> Belgium 1 #> France 1 #> Spain 1 #> USA 2 #> On Hold Sweden 1 #> USA 3 #> Resolved Austria 1 #> Denmark 1 #> Spain 1 #> USA 1 #> Shipped Australia 17 #> Austria 6 #> Belgium 6 #> Canada 7 #> Denmark 5 #> Finland 9 #> France 36 #> Germany 7 #> Ireland 2 #> Italy 8 #> Japan 6 #> Norway 9 #> Philippines 3 #> Singapore 9 #> Spain 32 #> Sweden 5 #> Switzerland 2 #> UK 12 #> USA 105