Chart explanation, below code.
pacman::p_load(pacman,tidyverse,gridExtra,zoo)
# Read the data
amazon_data <- read_csv("Amazon.csv", col_types = cols(
Year = col_character(),
`Billion USD` = col_double()
))
# Convert Year to a date format for easier plotting
amazon_data <- amazon_data %>%
separate(Year, into = c("Year", "Quarter"), sep = " ") %>%
mutate(Quarter = case_when(
Quarter == "Q1" ~ "01",
Quarter == "Q2" ~ "04",
Quarter == "Q3" ~ "07",
Quarter == "Q4" ~ "10"
),
Date = as.Date(paste(Year, Quarter, "01", sep = "-"))
) %>%
select(Date, `Billion USD`)
# Line chart with a smoothed line
line_plot <- ggplot(amazon_data, aes(x = Date, y = `Billion USD`)) +
geom_line(color = "blue") +
geom_smooth(method = "loess", color = "red") +
labs(title = "Amazon Sales Revenue Over Time", x = "Year", y = "Billion USD") +
theme_minimal()
# Bar chart
bar_plot <- ggplot(amazon_data, aes(x = Date, y = `Billion USD`)) +
geom_bar(stat = "identity", fill = "lightblue") +
labs(title = "Quarterly Amazon Sales Revenue", x = "Year", y = "Billion USD") +
theme_minimal()
# Boxplot to show distribution by year
box_plot <- ggplot(amazon_data, aes(x = factor(year(Date)), y = `Billion USD`)) +
geom_boxplot(fill = "orange") +
labs(title = "Distribution of Amazon Sales Revenue by Year", x = "Year", y = "Billion USD") +
theme_minimal()
# Check for seasonality by aggregating the average sales per quarter
seasonality_data <- amazon_data %>%
mutate(Quarter = quarters(Date)) %>%
group_by(Quarter) %>%
summarise(Average_Sales = mean(`Billion USD`))
# Plot the seasonality data
seasonality_plot <- ggplot(seasonality_data, aes(x = Quarter, y = Average_Sales)) +
geom_bar(stat = "identity", fill = "lightgreen") +
labs(title = "Average Amazon Sales by Quarter", x = "Quarter", y = "Average Sales (Billion USD)") +
theme_minimal()
# Combine all plots into a single display
grid.arrange(line_plot, bar_plot, box_plot, seasonality_plot, ncol = 1)
## `geom_smooth()` using formula = 'y ~ x'

Amazon Sales Revenue Over Time:
This line graph depicts the overall growth of Amazon’s quarterly
sales revenue from 2013 to 2024. The blue line represents the actual
quarterly revenue, showing a consistent upward trend over the years. The
red line is a trendline, smoothing out the fluctuations and highlighting
the general growth trajectory. The peaks in the blue line signify
quarters with exceptionally high sales, likely due to seasonal factors
like holiday shopping or special promotions. The general trend indicates
that Amazon’s revenue has been steadily growing over time.
Quarterly Amazon Sales Revenue:
This bar chart displays the quarterly sales revenue for each quarter
from 2013 to 2024. The height of each bar represents the revenue for
that specific quarter. The chart visually reinforces the upward trend
seen in the line graph, with the bars generally getting taller over
time. The fluctuations in the bars highlight the seasonality of Amazon’s
sales, with some quarters consistently performing better than
others.
Distribution of Amazon Sales Revenue by Year:
This boxplot offers a different perspective on Amazon’s annual sales
revenue from 2013 to 2023. Each box represents the distribution of
quarterly sales within a year. The line within the box indicates the
median revenue, the box itself shows the interquartile range (middle 50%
of the data), and the whiskers extend to the minimum and maximum values
(excluding outliers). The black dots represent outliers, indicating
exceptionally high or low quarterly sales for a given year. The chart
reveals the increasing trend in median and overall revenue over the
years, as well as the widening range of quarterly sales as the business
grows.
Average Amazon Sales by Quarter:
This bar chart displays the average sales for each quarter (Q1, Q2,
Q3, Q4) across all years. Q4 consistently stands out as the
highest-performing quarter, likely due to the holiday season. The
relatively consistent heights of the bars suggest that, while the
overall revenue has grown, the relative performance of each quarter has
remained fairly stable.
In summary:
Amazon’s sales revenue has experienced significant growth from 2013
to 2024, with a clear upward trend.
The growth is not linear, with fluctuations caused by seasonal
factors and special events.
Q4 consistently stands out as the strongest quarter, likely driven
by holiday shopping.
The range of quarterly sales has expanded as the business has grown,
but the relative performance of each quarter has remained fairly
consistent.