Show the code
library(tidyverse)
library(lubridate)
library(riem)
library(scales)DS 350 · Data Wrangling & Visualization
Spencer Payne
Does temperature drive car wash sales? I converted transaction timestamps from UTC to local time, removed invalid sales, and rolled them up to the hour. Then I pulled hourly weather observations for the Rexburg airport with the riem package and joined them to sales by hour.
After inspecting the data, I decided to remove rows with missing time values, missing sale amounts, and negative sale amounts. I did not remove high sales just because they were high, because a large transaction could still be a real sale.
ggplot(carwash_weather_clean, aes(x = hour_of_day, y = amount, color = tmpf)) +
geom_point(alpha = 0.65) +
scale_y_continuous(labels = dollar_format()) +
scale_x_continuous(breaks = seq(0, 23, by = 2)) +
labs(
title = "Car Wash Sales by Hour of Day",
x = "Hour of day",
y = "Total car wash sales per hour",
color = "Temperature (F)"
) +
theme_minimal()
From the data we can see that the car wash has specific operating hours. This helps us to determine now when during those operating hours temperature and sales begin to influence one another. There seems to be no correlation of temperature and sales during operating hours. Sales peak in the morning, the middle of the day and the afternoon on different days. It would stand to reason though, from looking at the density of the data points on hotter days, that the warmer and more comfortable the day is, the more likely people are to go get a car wash.