Filter a pivot table
pivot_focus(.data, ...)
.data | A data.frame or a pivot_prep object |
---|---|
... | Variables or calculation to group by |
retail_orders %>% pivot_rows(status) %>% pivot_columns(country) %>% pivot_values(total_sales = sum(sales)) %>% pivot_focus( country %in% c("Japan", "USA", "UK"), status == "Shipped", total_sales > 200000 )#> UK USA Total #> Shipped 428472.21 3372204.28 3800676.49 #> Total 428472.21 3372204.28 3800676.49