The Quantified Self (QS) is a movement motivated to leverage the synergy of wearables, analytics, and “Big Data”. This movement exploits the ease and convenience of data acquisition through the internet of things (IoT) to feed the growing obsession of personal informatics and quotidian data. The objective of this project is to visualize and generate questions and insights about a topic that is of immense importance to themselves. It also produces a wealth of data in a variety of forms. Hence, I have decided to use my spending summary to analyze and learn spending habits and patterns. I have considered Categories, Date and Amount of expenses from February 2022 - February 2023.
Answer: The distribution of expenses by category is not even. The maximum expenditure is in Services category, whereas minimum is in Government Services.
Answer: The graphical trend of Services over time shows that maximum expenses occurred in the duration of April - August.
Answer: The overall trend is quite uniform with maximum expenditure in the month of September.
Answer: During September, maximum spending occurred in Merchandises, followed by Restaurants and Interest.
Answer: According to the chart, the overall spending has declined since December 2022 for all categories.
Conclusion: The overall analysis showed the trends in spending, categories and timeline of the expenses. The expenditure summary is reflective of the events in my life. For instance, I had to move twice to two different cities from June to October which were depicted in the overall trend, monthly trend (September) and amounted to maximum spending in last year. This is an interesting style of tracking personal habits and understanding patterns. It is also helpful in planning personal expenditure and preventing unnecessary expenses which could be a step in improving one’s financial health.
---
title: "ANLY 512 - FINAL PROJECT"
author: "Sneha Yerunkar"
date: "02-21-2023"
output:
flexdashboard::flex_dashboard:
orientation: columns
Horizontal_layout: fill
social: menu
source: embed
html_document: default
df_print: paged
pdf_document: default
---
# Table of Contents {.sidebar}
* Introduction
* Distribution of Expenses by Category
* Trend of Expenditure on Services Over Time
* Trend of Overall Expenses Over Time
* Distribution of Expenses by Category for September
* Trend of Overall Expenses in Last Six Months
* Conclusion
# **Introduction**
Row {data-height=230}
-------------------------------------
### **Overview**
The Quantified Self (QS) is a movement motivated to leverage the synergy of wearables, analytics, and
“Big Data”. This movement exploits the ease and convenience of data acquisition through the internet
of things (IoT) to feed the growing obsession of personal informatics and quotidian data.
The objective of this project is to visualize and generate questions and insights about a topic that is of immense importance to themselves. It also produces a wealth of data in a variety of forms. Hence, I have decided to use my spending summary to analyze and learn spending habits and patterns. I have considered Categories, Date and Amount of expenses from February 2022 - February 2023.
Row
-------------------------------------
### **Objective**
1. What is the distribution of the amount spent by categories?
2. Do you find any trend in the category you spent the most?
3. What has the overall trend of expenses been over the duration of data?
4. What is the distribution by Category for the month with maximum spending?
5. Has the trend of spending changed over the past six months?
```{r setup, include=FALSE}
library(flexdashboard)
library(knitr)
library(ggplot2)
library(dplyr)
library(xts)
library(lubridate)
library(plotly)
data <- read.csv("C:/Users/drsne/Downloads/Credit_Year.csv")
head(data)
data$Post.date <- as.Date(data$Post.date)
data$Amount <- as.numeric(data$Amount)
```
# **Distribution of Expenses by Category**
```{r}
# Create the pie chart
fig <- plot_ly(
data,
labels = ~Category,
values = ~Amount,
type = "pie"
)
# Add a title
fig <- fig %>% layout(title = list(text = "Amount Spent by Category", x = 0, y = -0.1))
# Display the chart
fig
```
# **Trend of Expenditure on Sevices Over Time**
```{r}
category_data <- subset(data, Category == "Services")
# Summarize the data by date
category_summary <- aggregate(Amount ~ Post.date + Category, category_data, sum)
# Create a line chart of the category spending over time
ggplot(category_summary, aes(x = Post.date, y = Amount, color = Category)) +
geom_line() +
labs(x = "Date", y = "Total Amount Spent") +
ggtitle("Services Spending Over Time")
```
# **Trend of Overall Expenses Over Time**
```{r}
library(ggplot2)
library(lubridate)
# Assume that 'data' is the data frame with the expense data
ggplot(data, aes(x = Post.date, y = Amount, color = Amount)) +
geom_line() +
scale_color_gradient(low = "blue", high = "red") +
labs(x = "Date", y = "Amount", title = "Expenses Over Time")
```
# **Distribution of Expenses by Category for September**
```{r}
### Chart C
# Create a subset of the data for September
sept_data <- subset(data, format(Post.date, "%m") == "09")
# Summarize the data by category
sept_summary <- aggregate(Amount ~ Category, sept_data, sum)
# Create a bar chart of the categories sorted by amount
library(ggplot2)
ggplot(sept_summary, aes(x = reorder(Category, -Amount), y = Amount, fill = Category)) +
geom_bar(stat = "identity") +
labs(x = "Category", y = "Total Amount Spent") +
coord_flip()
```
# **Trend of Overall Expenses in Last Six Months**
```{r}
library(dplyr)
library(lubridate)
library(ggplot2)
library(plotly)
six_month_data <- subset(data, data$Post.date >= as.Date("2022-08-01") & data$Post.date <= as.Date("2023-02-01"))
# Assume that 'six_month_data' is the data frame with the expense data
# Convert 'date' column to Date format
six_month_data$Post.date <- as.Date(six_month_data$Post.date)
# Create a new column for month
six_month_data$month <- floor_date(six_month_data$Post.date, unit = "month")
# Group the data by month and category, and calculate the total expenses for each group
monthly_expenses <- six_month_data %>%
group_by(Category, month) %>%
summarize(total_expenses = sum(Amount))
# Create a line chart using ggplot2
ggplot(monthly_expenses, aes(x = month, y = total_expenses, color = Category)) +
geom_line() +
labs(x = "Month", y = "Total expenses") +
scale_x_date(date_labels = "%b %Y") +
theme_bw()
# Convert the ggplot to a plotly object
p <- ggplotly()
# Display the interactive plot in the RStudio Viewer or in the browser
p
```
# **Analysis & Conclusion**
1. What is the distribution of the amount spent by categories?
Answer: The distribution of expenses by category is not even. The maximum expenditure is in Services category, whereas minimum is in Government Services.
2. Do you find any trend in the category you spent the most?
Answer: The graphical trend of Services over time shows that maximum expenses occurred in the duration of April - August.
3. What has the overall trend of expenses been over the duration of data?
Answer: The overall trend is quite uniform with maximum expenditure in the month of September.
4. What is the distribution by Category for the month with maximum spending?
Answer: During September, maximum spending occurred in Merchandises, followed by Restaurants and Interest.
5. Has the trend of spending changed over the past six months?
Answer: According to the chart, the overall spending has declined since December 2022 for all categories.
Conclusion:
The overall analysis showed the trends in spending, categories and timeline of the expenses. The expenditure summary is reflective of the events in my life. For instance, I had to move twice to two different cities from June to October which were depicted in the overall trend, monthly trend (September) and amounted to maximum spending in last year. This is an interesting style of tracking personal habits and understanding patterns. It is also helpful in planning personal expenditure and preventing unnecessary expenses which could be a step in improving one's financial health.