Week 1 assignment

Approach

For this assignment, I selected a retail sales dataset containing 1,000 transactions. The dataset includes information about individual transactions, including product category, quantity, price per unit, and total sales amount.

I chose this dataset because I work in retail analytics and wanted to work with familiar data. I plan to select the variables most relevant to sales and use them to create a smaller data frame. I would also like to summarize sales by product category to compare the performance of different categories.

The dataset was obtained from a public GitHub repository and contains 1,000 retail transactions across three product categories: Beauty, Clothing, and Electronics.

Data loading

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
retail <- read.csv("https://raw.githubusercontent.com/Oragant/Retail-Sales-Dashboard/main/retail_sales_dataset.csv")

Data transformation

I selected the variables most relevant to sales and renamed the columns to make them easier to interpret. I then grouped the data by product category and calculated total sales for each category.

retail_subset <- retail[c("Date", "Product.Category", "Quantity",
                          "Price.per.Unit", "Total.Amount")]
names(retail_subset) <- c("date", "category", "quantity", "unit_price", "sales")
retail_subset %>%
  group_by(category) %>%
  summarise(total_sales = sum(sales)) %>%
  arrange(desc(total_sales))
# A tibble: 3 × 2
  category    total_sales
  <chr>             <int>
1 Electronics      156905
2 Clothing         155580
3 Beauty           143515

Conclusion

Electronics generated the highest total sales at $156,905. This analysis could be extended by comparing sales over time or examining quantity sold and average price by category.