Pizza Sales Transactions
library(rpivotTable)
library(gt)
library(dplyr)
library(lubridate)
df <- as.data.frame(gt::pizzaplace)%>%
mutate(date = as.Date(date, "%Y-%m-%d"),
month = floor_date(date, "month"),
year = floor_date(date, "year"))
head(df)
## id date time name size type price month
## 1 2015-000001 2015-01-01 11:38:36 hawaiian M classic 13.25 2015-01-01
## 2 2015-000002 2015-01-01 11:57:40 classic_dlx M classic 16.00 2015-01-01
## 3 2015-000002 2015-01-01 11:57:40 mexicana M veggie 16.00 2015-01-01
## 4 2015-000002 2015-01-01 11:57:40 thai_ckn L chicken 20.75 2015-01-01
## 5 2015-000002 2015-01-01 11:57:40 five_cheese L veggie 18.50 2015-01-01
## 6 2015-000002 2015-01-01 11:57:40 ital_supr L supreme 20.75 2015-01-01
## year
## 1 2015-01-01
## 2 2015-01-01
## 3 2015-01-01
## 4 2015-01-01
## 5 2015-01-01
## 6 2015-01-01
rpivotTable(data = df,
cols = "month", rows = "type", vals = "price",
rendererName = "Bar Chart", aggregatorName = "Sum")