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(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(lubridate)
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
library(tidyr)
library(readxl)
Makeupdb <- read_excel("Makeupdb.xlsx")
View(Makeupdb)
makeup_summary <- Makeupdb %>%
mutate(Month = floor_date(Date, "month")) %>%
group_by(Month, Product) %>%
summarise(TotalDollars = sum(Dollars, na.rm = TRUE)) %>%
ungroup()
## `summarise()` has grouped output by 'Month'. You can override using the
## `.groups` argument.
ggplot(makeup_summary, aes(x = Month, y = TotalDollars, fill = Product)) +
geom_area(alpha = 0.6, position = 'stack') +
labs(title = "Monthly Sales by Product", x = "Month", y = "Total Sales (Dollars)") +
theme_minimal() +
scale_fill_brewer(palette = "Pastel1")

####The area plot showing monthly sales for different makeup products tells us that eyeliner sells the most, often reaching over 5,000 and even hitting 7,500 at its peak. Foundation is the next best-seller, followed by lip gloss. Lipstick doesn't sell as much, and mascara sells the least, showing us which makeup items people buy more and less often.
library(readxl)
Sales_by_Region <- read_excel("Sales+by+Region.xlsx")
View(Sales_by_Region)
plot_ly(data = Sales_by_Region,
x = ~`Number of Products`,
y = ~`Percentage of Market Share`,
size = ~Sales,
color = ~`Sales Region`,
colors = "Blues",
type = 'scatter',
mode = 'markers',
marker = list(sizemode = 'diameter', sizeref = 0.1, line = list(width = 2, color = 'rgb(255, 255, 255)'))) %>%
layout(title = 'Sales Performance by Region',
xaxis = list(title = 'Number of Products'),
yaxis = list(title = 'Percentage of Market Share (%)'),
showlegend = TRUE)
####The bubble chart shows how different regions are doing in sales. The Midwest (MW) is doing the best, with the most projects and the biggest share of sales. The Northwest (NW) and Southeast (SE) are also doing well, but not as much as the Midwest. The Southwest (SW) and Northeast (NE) are behind the others, meaning they have fewer sales and projects.