This dashboard explores my spending habits between the months of September 2022 and January 2023. The reason I chose to collect this data and explore it, is because ever since I started my master’s I have been trying to save more and be aware of my spending habits. This project forced me to sit down and record my spending habits in order to analyze and understand where I can potentially save more. In order to start saving, keeping a record of my expenses is my first step. I will be using the data analysis and visualizations I performed in this project as a way to come up with a future budget to stick to and what expenses to reduce or cut out.
Throughout this dashboard, there will be some interesting graphical representations which include but are not limited to the following research questions:
The Data includes 5 variables and 181 observations which fall between the September 2022 and January 2023. I recorded the data on an excel spread sheet and when I was finished stored it on my local drive as a CSV file. The data variables are as follows:
Date: Date of the month/year
Month: Months (September - January)
Year: Year (2022 - 2023)
Category: The things I spent my money on which include:
Rent, WIFI, Groceries, Electricity, Takeout, Gas, Car insurance, Car oil change, Entertainment, Gym, Night out, Parking, Printing, Shopping, Phone, Medicine, Shipping. Amount: The dollar $ value of my expenses
The two figures above illustrate my overall spending habits. The first figure is a pie chart that illustrates my overall expense proportions by category. Rent constitutes to the most expense, followed by Groceries then Electricity. All of these are necessities so it makes sense that these three are my top three expenses. The second figure is a bar chart that illustrates my average spending habit per season. Fall is the longest season according to my data since it ranges from end of September to the end of December so there is more data on the bar chart for fall.
The two figures above illustrate the comparison of Groceries and Takeout expenses. The first figure is a box plot that illustrates the range of expenses between Groceries and Takeout. We can see that Groceries has a maximum of 73.52, median of 20.98 and a minimum of 6.18; while Takeout has a maximum of 35.84, median of 9.85, and a minimum of 1.06. The second figure is a bar chart that illustrates the total Groceries and total Takeout per month. We can see that I spent the most on Groceries in September and the least in October; while I spent the most on Takeout in November and the least in October.
The first figure is a donut chart that illustrates my housing expense proportions. This includes WIFI, Rent, Groceries, and Electricity. Rent is clearly my biggest housing expense, followed by Groceries then Electricity, and lastly WIFI. The second figure is a scatter plot illustrating the fluctuation of my Electricity expense by Months. September has the highest electricity expense followed by January. In comparison September is the warmest month while January is the coldest month according to my data which means I would most likely crank up the AC/heat during those months causing higher costs.
The two figures above illustrate the comparison of my extra cost expenses and a comparison of the two highest extra costs. The first figure is a row chart that illustrates the total Amount of each extra expense - Entertainment, Gym, Night out, Parking, Printing, Shopping, Takeout. It is clear to see that Night outs has the highest expense followed by Shopping and the least expense is printing which is barely visible because it is so small.The second figure is a box plot that illustrates the range of expenses between Night out and Shopping. Above we can see that Night out has a maximum of 47.69, median of 14.50 and a minimum of 5.00; while Takeout has a maximum of 72.69, median of 21.71, and a minimum of 9.00.
Visualization Methods The visualizations I chose to use are a Pie chart to illustrate the proportions of my spending habits, a Bar plot to compare my average spending habits by seasons and to compare whether I spend more on groceries or takeout by months, a Box plot to compare whether I spend more on Groceries or Takeout and whether I spend more on Nights out or Shopping, a Donuts chart to show the proportions of Housing expenses, a scatter plot showing the fluctuation of Electricity expense by Months, and a Row chart to show the comparisons of extra costs.
Data Manipulation and Tools Utilized The main tools I used for this project are dplyr, ggplot, plotly, and flexdashboard. dplyr to filter and select which variables and categories to use in each visualization. ggplot to create majority of my visualizations including the bar plots, box plots, scatter plot, and row chart. plotly to create the pie chart, donuts chart, and to provide interactivity for each of my visualizations. Lastly, I used flexdashboard to create the dashboard.
Summary I performed a thorough analysis of my spending habits between the months of September 2022 - January 2023. I took into account the various expense categories and did some comparison based on months and seasons. When looking at this dashboard and the various visualizations, it is clear to see that I spend more money on groceries but that it was quite close. Therefore, I can benefit from cutting my takeout expense since it is an extra cost and I am already spending so much on groceries. The two other costs I could benefit from cutting out include Night out and Shopping expenses as they are not necessities and by looking at my visualizations it is clear that I spend a decent amount of these two extra costs. Furthermore, my electric bill seems to be dependent on the weather/months and that tells me that I need to prioritize during the months with extreme weather.
---
title: "Spending Habits"
author: "Belosan Jekale"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
source_code: embed
theme:
bootswatch: united
---
```{r setup1, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(dplyr)
library(dygraphs)
library(ggplot2)
library(plotly)
library(hrbrthemes)
```
# Introduction
### Introduction
This dashboard explores **my spending habits** between the months of **September 2022 and January 2023**. The reason I chose to collect this data and explore it, is because ever since I started my master's I have been trying to save more and be aware of my spending habits. This project forced me to sit down and record my spending habits in order to analyze and understand where I can potentially save more. In order to start saving, keeping a record of my expenses is my first step. I will be using the data analysis and visualizations I performed in this project as a way to come up with a future budget to stick to and what expenses to reduce or cut out.
Throughout this dashboard, there will be some interesting graphical representations which include but are not limited to the following **research questions**:
* What are my overall spending proportions?
* Which category constitutes to the most expense by month?
* Do I spend more on groceries or takeout? Overall comparison? Monthly comparison?
* What is my average housing expense?
* Which month has the highest Electricity expense and why?
* Which extra cost categories do I spend the most money on?
* Compare the two Highest extra expense categories?
**The Data** includes 5 variables and 181 observations which fall between the September 2022 and January 2023. I recorded the data on an excel spread sheet and when I was finished stored it on my local drive as a CSV file.
The data variables are as follows:
* **Date**: Date of the month/year
* **Month**: Months (September - January)
* **Year**: Year (2022 - 2023)
* **Category**: The things I spent my money on which include:
Rent, WIFI, Groceries, Electricity, Takeout, Gas, Car insurance, Car oil change, Entertainment, Gym, Night out, Parking, Printing, Shopping, Phone, Medicine, Shipping.
* **Amount**: The dollar $ value of my expenses
```{r setup2, include=FALSE}
spendingData <- read.csv("C:/Users/billy/OneDrive/Documents/ANLY 512/spending (1).csv")
spendingData <- spendingData %>%
select(c("Date", "Month", "Year", "Season", "Category", "Amount"))
spendingData$Month <- factor(spendingData$Month)
spendingData$Date <- factor(spendingData$Date)
spendingData$Season <- factor(spendingData$Season)
spendingData$Category <- factor(spendingData$Category)
str(spendingData)
summary(spendingData)
```
# Overall Spending
Column {data-width=750}
-----------------------------------------------------------------------
### Overall Expenses
```{r piechart}
expensePieChart <- plot_ly(spendingData, labels = ~Category, values = ~Amount, type = 'pie')
expensePieChart <- expensePieChart %>%
layout(title = 'Overall Expenses by Category',
xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE))
expensePieChart
```
### Spending habits by season
```{r season}
expenseOverTime <- ggplot(spendingData, aes(x = Season, y = Amount, fill = Category)) +
stat_summary(fun = base::mean,
geom = "bar",
position = "dodge") +
theme_classic() +
coord_cartesian(ylim = c(0, 200)) +
labs(x = "Season",
y = "Amount ($)",
title = "My Spending Habit by Season",
color = "Category") +
theme(legend.position = "right")
ggplotly(expenseOverTime)
```
## row {data-height=70}
### Footnote
The two figures above illustrate my overall spending habits. The first figure is a pie chart that illustrates my overall expense proportions by category. **Rent constitutes to the most expense**, followed by Groceries then Electricity. All of these are necessities so it makes sense that these three are my top three expenses. The second figure is a bar chart that illustrates my average spending habit per season. Fall is the longest season according to my data since it ranges from end of September to the end of December so there is more data on the bar chart for fall.
# Groceries Vs Takeout
Column {data-width=650}
-----------------------------------------------------------------------
### Groceries Vs Takeout
```{r gVt}
groceriesVsTakeoutData <- spendingData %>%
select(c("Date", "Month", "Year", "Season", "Category", "Amount")) %>%
filter(Category %in% c("Groceries", "Takeout"))
groceriesVsTakeout <- ggplot(groceriesVsTakeoutData, aes(x = Category, y = Amount, fill = Category)) +
geom_boxplot() +
theme_classic() +
labs(x = "Category",
y = "Amount ($)",
title = "Groceries Vs Takeout") +
scale_fill_manual(values=c("pink3", "plum4"))
ggplotly(groceriesVsTakeout)
```
### Groceries Vs Takeout Bar
```{r bar}
groceriesVsTakeout2 <- ggplot(groceriesVsTakeoutData, aes(x = Month, y = Amount, fill = Category)) +
#geom_bar(stat="identity")+
stat_summary(fun = base::sum,
geom = "bar",
position = "dodge") +
theme_classic() +
labs(x = "Months",
y = "Amount ($)",
title = "Groceries Vs Takeout by Month") +
scale_fill_manual(name = "Category",
labels = c("Groceries", "Takeout"),
values = c("pink3", "plum4")) +
scale_x_discrete(limits = c("September", "October", "November", "December", "January"))
ggplotly(groceriesVsTakeout2)
```
## row {data-height=110}
### Footnote
The two figures above illustrate the comparison of Groceries and Takeout expenses. The first figure is a box plot that illustrates the range of expenses between Groceries and Takeout. We can see that Groceries has a maximum of 73.52, median of 20.98 and a minimum of 6.18; while Takeout has a maximum of 35.84, median of 9.85, and a minimum of 1.06. The second figure is a bar chart that illustrates the total Groceries and total Takeout per month. We can see that **I spent the most on Groceries in September and the least in October; while I spent the most on Takeout in November and the least in October**.
# Housing Expenses
Column {data-width=650}
-----------------------------------------------------------------------
### House Expense
```{r house}
houseExpenseData <- spendingData %>%
select(c("Date", "Month", "Year", "Season", "Category", "Amount")) %>%
filter(Category %in% c("Wifi", "Rent", "Groceries", "Electricity"))
houseDonutChart <- plot_ly(houseExpenseData, labels = ~Category, values = ~Amount) %>%
add_pie(hole = 0.4)
houseDonutChart <- houseDonutChart %>%
layout(title = 'Housing Expense',
xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE))
houseDonutChart
```
### Electricity Expense
```{r gas}
electricExpenseData <- spendingData %>%
select(c("Date", "Month", "Year", "Season", "Category", "Amount")) %>%
filter(Category == "Electricity")
electricExpense <- ggplot(electricExpenseData, aes(x = Month, y = Amount, fill = Category)) +
geom_point(size = 8) +
theme_classic() +
theme(legend.position="none") +
labs(x = "Month",
y = "Amount ($)",
title = "Electricity Expense (Sept. 2022 - Jan. 2023)") +
scale_fill_manual(name = "Category",
labels = "Electricity",
values = "green4") +
scale_x_discrete(limits = c("September", "October", "November", "December", "January"))
ggplotly(electricExpense)
```
## row {data-height=110}
### Footnote
The first figure is a donut chart that illustrates my housing expense proportions. This includes WIFI, Rent, Groceries, and Electricity. **Rent is clearly my biggest housing expense, followed by Groceries then Electricity, and lastly WIFI**. The second figure is a scatter plot illustrating the fluctuation of my Electricity expense by Months. **September has the highest electricity expense followed by January**. In comparison September is the warmest month while January is the coldest month according to my data which means I would most likely crank up the AC/heat during those months causing higher costs.
# Extra Expense
Column {data-width=650}
-----------------------------------------------------------------------
### Extra costs
```{r extra}
extraCostData <- spendingData %>%
select(c("Date", "Month", "Year", "Season", "Category", "Amount")) %>%
filter(Category %in% c("Entertainment", "Gym", "Night out", "Parking", "Printing", "Shopping", "Takeout"))
extraCost <- ggplot(extraCostData, aes(x = Amount, y = Category, fill = Category)) +
geom_bar(stat="identity")+
theme_classic() +
labs(x = "Amount ($)",
y = "Category",
title = "Comparison of Extra Expenses") +
scale_fill_manual(name = "Category",
labels = c("Entertainment", "Gym", "Night out", "Parking", "Printing", "Shopping", "Takeout"),
values = c("darkgreen", "darkblue", "darkred","darkorange", "violet", "pink", "plum4"))
ggplotly(extraCost)
```
### Shopping Vs Nightout
```{r sVn}
shoppingVsNightoutData <- spendingData %>%
select(c("Date", "Month", "Year", "Season", "Category", "Amount")) %>%
filter(Category %in% c("Shopping", "Night out"))
shoppingVsNightout <- ggplot(shoppingVsNightoutData, aes(x = Category, y = Amount, fill = Category)) +
geom_boxplot() +
theme_classic() +
labs(x = "Category",
y = "Amount ($)",
title = "Shopping Vs Nightout") +
scale_fill_manual(values=c("darkred", "pink"))
ggplotly(shoppingVsNightout)
```
## row {data-height=110}
### Footnote
The two figures above illustrate the comparison of my extra cost expenses and a comparison of the two highest extra costs. The first figure is a row chart that illustrates the total Amount of each extra expense - Entertainment, Gym, Night out, Parking, Printing, Shopping, Takeout. It is clear to see that **Night outs has the highest expense followed by Shopping and the least expense is printing** which is barely visible because it is so small.The second figure is a box plot that illustrates the range of expenses between Night out and Shopping. Above we can see that Night out has a maximum of 47.69, median of 14.50 and a minimum of 5.00; while Takeout has a maximum of 72.69, median of 21.71, and a minimum of 9.00.
# Conclusion
### Conclusion
**Visualization Methods**
The visualizations I chose to use are a Pie chart to illustrate the proportions of my spending habits, a Bar plot to compare my average spending habits by seasons and to compare whether I spend more on groceries or takeout by months, a Box plot to compare whether I spend more on Groceries or Takeout and whether I spend more on Nights out or Shopping, a Donuts chart to show the proportions of Housing expenses, a scatter plot showing the fluctuation of Electricity expense by Months, and a Row chart to show the comparisons of extra costs.
**Data Manipulation and Tools Utilized**
The main tools I used for this project are dplyr, ggplot, plotly, and flexdashboard.
dplyr to filter and select which variables and categories to use in each visualization. ggplot to create majority of my visualizations including the bar plots, box plots, scatter plot, and row chart. plotly to create the pie chart, donuts chart, and to provide interactivity for each of my visualizations. Lastly, I used flexdashboard to create the dashboard.
**Summary**
I performed a thorough analysis of my spending habits between the months of September 2022 - January 2023. I took into account the various expense categories and did some comparison based on months and seasons. When looking at this dashboard and the various visualizations, it is clear to see that I spend more money on groceries but that it was quite close. Therefore, I can benefit from cutting my takeout expense since it is an extra cost and I am already spending so much on groceries. The two other costs I could benefit from cutting out include Night out and Shopping expenses as they are not necessities and by looking at my visualizations it is clear that I spend a decent amount of these two extra costs. Furthermore, my electric bill seems to be dependent on the weather/months and that tells me that I need to prioritize during the months with extreme weather.