library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(completejourney)
## Welcome to the completejourney package! Learn more about these data
## sets at http://bit.ly/completejourney.
products %>%
filter(str_detect(product_type, regex("energy", ignore_case = TRUE))) %>%
group_by(product_category) %>%
inner_join(transactions_sample, by = 'product_id') %>%
mutate(day = lubridate::wday(transaction_timestamp, label = TRUE)) %>%
ggplot(aes(x = day, y = sales_value)) +
geom_bar(stat = "identity") +
ggtitle("Energy Drink Sales by Weekday")
library(tidyverse)
library(completejourney)
coupons %>%
filter(campaign_id == "26") %>%
inner_join(products) %>%
filter(str_detect(product_category, regex("frozen|frzn", ignore_case = TRUE))) %>%
inner_join(transactions_sample) %>%
ggplot(aes(x = package_size, y = sales_value)) +
geom_bar(stat = "identity") +
ggtitle("Frozen Products Associated with
Coupon Campaign 26 Sales by Package Size")
## Joining with `by = join_by(product_id)`
## Joining with `by = join_by(product_id)`
Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Cmd+Option+I.
library(tidyverse)
library(completejourney)
products %>%
filter(str_detect(product_category, regex("ice cream", ignore_case = TRUE))) %>%
inner_join(transactions_sample) %>%
ggplot(aes(x = quantity, y = sales_value)) +
geom_bar(stat = "identity") +
ggtitle("Ice Cream Sales by Quantity of Purchase")
## Joining with `by = join_by(product_id)`