Create a calendar heatmap to show daily online sales data over one year.
STEP 1:LOAD THE REQUIRED LIBRARIES
readxl: Reads Excel files.
dplyr: Data wrangling and transformation.
lubridate: Date parsing and manipulation.
ggplot2: Data visualization
scales: Formatting numeric and date scales in plots.
library(readxl)library(dplyr)
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
library(ggplot2)library(lubridate)
Attaching package: 'lubridate'
The following objects are masked from 'package:base':
date, intersect, setdiff, union
STEP 2:READ AND CONVERT THE DATA FROM EXCEL FILE
Reads data from the Excel file.
Contains two columns: Date (Excel serial format) and Simulated Sales.
# Read the Excel filesales_data <-read_excel("C:/Users/sanja/OneDrive/Desktop/april.xlsx")# Convert Excel serial date to Date formatsales_data <- sales_data %>%mutate(date =as.Date(Date, origin ="1899-12-30"),sales =`Simulated Sales`)sales_data