Simple Taco Sales Analysis

Author

Simranjeet Kaur

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.2     ✔ tibble    3.3.0
✔ lubridate 1.9.4     ✔ tidyr     1.3.1
✔ purrr     1.0.4     
── 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(palmerpenguins)

Attaching package: 'palmerpenguins'

The following objects are masked from 'package:datasets':

    penguins, penguins_raw
library(ggthemes)

glimpse(penguins)
Rows: 344
Columns: 8
$ species           <fct> Adelie, Adelie, Adelie, Adelie, Adelie, Adelie, Adel…
$ island            <fct> Torgersen, Torgersen, Torgersen, Torgersen, Torgerse…
$ bill_length_mm    <dbl> 39.1, 39.5, 40.3, NA, 36.7, 39.3, 38.9, 39.2, 34.1, …
$ bill_depth_mm     <dbl> 18.7, 17.4, 18.0, NA, 19.3, 20.6, 17.8, 19.6, 18.1, …
$ flipper_length_mm <int> 181, 186, 195, NA, 193, 190, 181, 195, 193, 190, 186…
$ body_mass_g       <int> 3750, 3800, 3250, NA, 3450, 3650, 3625, 4675, 3475, …
$ sex               <fct> male, female, female, NA, female, male, female, male…
$ year              <int> 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007…
ggplot(
  data = penguins,
  mapping = aes(x = flipper_length_mm, y = body_mass_g)
)+
  geom_point()
Warning: Removed 2 rows containing missing values or values outside the scale range
(`geom_point()`).

library(tidyverse)

data <- read_csv("taco.csv")
Rows: 1000 Columns: 13
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (6): Restaurant_Name, Location, Order_Time, Delivery_Time, Taco_Size, Ta...
dbl (6): Order_ID, Delivery_Duration, Toppings_Count, Distance, Price, Tip
lgl (1): Weekend_Order

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
glimpse(data)
Rows: 1,000
Columns: 13
$ Order_ID          <dbl> 770487, 671858, 688508, 944962, 476417, 678856, 1836…
$ Restaurant_Name   <chr> "El Taco Loco", "El Taco Loco", "Taco Haven", "Spicy…
$ Location          <chr> "New York", "San Antonio", "Austin", "Dallas", "San …
$ Order_Time        <chr> "1/8/2024 14:55", "23-11-2024 17:11", "21-11-2024 20…
$ Delivery_Time     <chr> "1/8/2024 15:36", "23-11-2024 17:25", "21-11-2024 21…
$ Delivery_Duration <dbl> 41, 14, 38, 45, 15, 83, 45, 31, 17, 73, 64, 29, 11, …
$ Taco_Size         <chr> "Regular", "Regular", "Large", "Regular", "Large", "…
$ Taco_Type         <chr> "Chicken Taco", "Beef Taco", "Pork Taco", "Chicken T…
$ Toppings_Count    <dbl> 5, 1, 2, 2, 0, 0, 1, 3, 2, 1, 1, 4, 2, 1, 1, 2, 5, 4…
$ Distance          <dbl> 3.01, 6.20, 20.33, 3.00, 24.34, 16.70, 9.57, 9.80, 1…
$ Price             <dbl> 9.25, 4.25, 7.00, 5.50, 4.50, 3.00, 5.75, 6.75, 5.50…
$ Tip               <dbl> 2.22, 3.01, 0.02, 1.90, 1.14, 2.32, 0.63, 2.97, 0.33…
$ Weekend_Order     <lgl> FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE…
ggplot(data = data)

ggplot(data)

ggplot(
  data = data,
  mapping = aes(x = Distance, y = Tip)
)

ggplot(
  data = data,
  mapping = aes(x = Distance, y = Tip)
)+
  geom_point()

ggplot(
  data = data,
  mapping = aes(x = Distance, y = Tip, color = Taco_Size)
) +
  geom_point()