This data visualization is about the expenditures from July to December in 2018. I collected the data from one of my credit cards which is mainly used for daily expenditures including Food/drink, Restaurants, Cosmetics, Transportation and Groceries.
Data is collected from credit card statement from 7/1/2018-12/31/2018
5 questions:
What is the total amount expensed in different categories by month in 2018?
Which category expensed the most during the late six months in 2018?
For Cosmetics expenses, what is the respective expenditures by each month?
In August and December, which category expensed the most?
Compared in Holiday Season month, November and December, what are the differences by amount expensed and category expensed the most?
Date Month Description
9/30/2018 : 7 Aug:42 TRADER JOE'S #547 QPS BROOKLYN NY : 18
11/24/2018: 6 Dec:39 TARGET BROOKLYN NY : 11
8/11/2018 : 6 Jul:41 NORDSTROM DIRECT #0808 CEDAR RAPIDS IA: 5
12/15/2018: 5 Nov:31 RAIN AFRICA USA NEW YORK NY : 5
7/1/2018 : 5 Oct:42 FLYING TIGER COPENHAGEN BROOKLYN NY : 4
7/21/2018 : 5 Sep:35 MSF* CPFC OPCO LLC NEW YORK NY : 4
(Other) :196 (Other) :183
Amount Category
Min. : 2.71 Cosmetics :38
1st Qu.: 11.32 Food/Drink :38
Median : 28.07 Home Supplies:34
Mean : 46.72 Appeals :24
3rd Qu.: 59.99 Groceries :21
Max. :458.04 Restaurants :21
(Other) :54
'data.frame': 230 obs. of 5 variables:
$ Date : Factor w/ 128 levels "10/1/2018","10/10/2018",..: 64 64 64 64 64 73 81 83 84 85 ...
$ Month : Factor w/ 6 levels "Aug","Dec","Jul",..: 3 3 3 3 3 3 3 3 3 3 ...
$ Description: Factor w/ 168 levels "A EAGLE OUT00023549041 BROOKLYN NY",..: 65 65 140 157 159 48 62 30 14 1 ...
$ Amount : num 8.75 8.75 21.23 41.88 14.14 ...
$ Category : Factor w/ 16 levels "Appeals","Books",..: 15 15 14 1 9 11 14 1 15 1 ...
There are 5 variables interested in.
Date: Transaction date when the transaction actually happened.
Month: Cluttering the transaction Date by month.
Description: Breakdown on purchases information.
Amount: Amount spent on each category.
Category: Organizing different purchases into categories accounting description.
In this graph, I used color dots to present the amounts of different categories I purchased from July to December in 2018. In order to see which month I spent the most, we need to summarize the total amount by different categories in each month. As we can see from the graph that the total amount spent in December is the highest.
This graph demonstrates subtotal amount of each category. From the graph, we can see that I spent a lot in Cosmetics because in late of the year, the cosmetics merchants always has yearly sale around Thanksgiving and Christmas. That is also the period I need to prepare Christmas gifts for relatives and friends and cosmetics value sets would be my first choice.
As the graph shown, the highest month I expensed in Cosmetics is August due to this is the month I usually need to buy new products in preparation of Fall’s coming and also in 2018, it was the first year that Sephora launched Semi-yearly sales.
Obviously, Cosmetics is the biggest part of my expenses in August and in December Gift is a big part of my expenses. In addition, in December, I spent a lot in Travel/Entertainment due to a planned trip with my family.
Compared Amount expensed in November and December, I spent a lot in Travel/Entertainment due to prepaid expenses and paid expense of the planned trip. Meanwhile I spent in Gifts in November to prepare the Gifts for Thanksgiving and Christmas and purchased decorations in Home Supplies to decor the living room.
---
title: "512 Final Project"
author: "Meng Zhang"
Due date: "February 22, 2019"
output:
flexdashboard::flex_dashboard:
storyboard: true
orientation: columns
vertical_layout: fill
social: menu
source_code: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
library(knitr)
library(ggplot2)
library(readxl)
library(dplyr)
library(xts)
library(plotly)
data <- read.csv("~/07012018_12312018_credit card.csv")
```
###Overview of the Quantified Self movement
This data visualization is about the expenditures from July to December in 2018. I collected the data from one of my credit cards which is mainly used for daily expenditures including Food/drink, Restaurants, Cosmetics, Transportation and Groceries.
Data is collected from credit card statement from 7/1/2018-12/31/2018
5 questions:
1) What is the total amount expensed in different categories by month in 2018?
2) Which category expensed the most during the late six months in 2018?
3) For Cosmetics expenses, what is the respective expenditures by each month?
4) In August and December, which category expensed the most?
5) Compared in Holiday Season month, November and December, what are the differences by amount expensed and category expensed the most?
###Data preparation
```{r}
summary(data)
str(data)
```
***
There are 5 variables interested in.
1. Date: Transaction date when the transaction actually happened.
2. Month: Cluttering the transaction Date by month.
3. Description: Breakdown on purchases information.
4. Amount: Amount spent on each category.
5. Category: Organizing different purchases into categories accounting description.
###Q1. What is the total amount expensed in different categories by month?
Row {data-height=600}
```{r}
library(ggplot2)
fill <- "gold10"
line <- "goldenrod10"
p<- ggplot(data, aes(x=Month, y=Amount, color=Category)) +
geom_point(aes(size = 5, frame = Month, ids = Category))+
scale_x_discrete(limits=c("Jul","Aug","Sep","Oct","Nov","Dec")) +
labs(title = "Total Amount Expensed of Each Month", x = "Month", y = "Total Amount Expensed")+
theme(plot.title = element_text(size = 13, face = "bold", hjust = 0.3), axis.title.y = element_text(vjust = 10, size = 11), axis.title.x = element_text(size = 11))
p
```
***
In this graph, I used color dots to present the amounts of different categories I purchased from July to December in 2018. In order to see which month I spent the most, we need to summarize the total amount by different categories in each month. As we can see from the graph that the total amount spent in December is the highest.
###Q2. Which category expensed the most during the late six months in 2018?
```{r}
library(ggplot2)
p<- ggplot(data, aes(x = Category, y=as.numeric(gsub('[$,]', '', Amount)))) +
geom_bar(stat = "identity", fill = "pink")+
labs(title = "Amount expensed per Category", x = "Category", y = "Amount (Expensed by category)") +
coord_flip()
p
```
***
This graph demonstrates subtotal amount of each category. From the graph, we can see that I spent a lot in Cosmetics because in late of the year, the cosmetics merchants always has yearly sale around Thanksgiving and Christmas. That is also the period I need to prepare Christmas gifts for relatives and friends and cosmetics value sets would be my first choice.
###Q3. For Cosmetics expenses, what is the respective expenditures by each month?
Row {data-height=600}
```{r}
data1<- subset(data, Category=='Cosmetics')
p<- ggplot(data1, aes(x = Month, y=as.numeric(gsub('[$,]', '', Amount)))) +
geom_bar(stat = "identity", fill = "lightgreen")+
scale_x_discrete(limits=c("Jul","Aug","Sep","Oct","Nov","Dec")) +
labs(title = "Cosmetics Expenditures by each Month", x = "Month", y = "Amount") +
theme(plot.title = element_text(size = 13, face = "bold", hjust = 0.3), axis.title.y = element_text(vjust = 10, size = 11), axis.title.x = element_text(size = 11))
p
```
***
As the graph shown, the highest month I expensed in Cosmetics is August due to this is the month I usually need to buy new products in preparation of Fall's coming and also in 2018, it was the first year that Sephora launched Semi-yearly sales.
###Q4. In August and December, Which category expensed the most?
```{r}
data2<- subset(data, Month=='Aug')
p1<- ggplot(data2, aes(x = Category, y=as.numeric(gsub('[$,]', '', Amount)), fill=Category)) +
geom_bar(stat = "identity", fill = "pink")+
labs(title = "Expenditures by Category", x = "Category", y = "Amount") +
coord_flip()
p1
data3<- subset(data, Month=='Dec')
p2<- ggplot(data3, aes(x = Category, y=as.numeric(gsub('[$,]', '', Amount)), fill=Category)) +
geom_bar(stat = "identity", fill = "lightblue")+
labs(title = "Expenditures by Category", x = "Category", y = "Amount") +
coord_flip()
p2
```
***
Obviously, Cosmetics is the biggest part of my expenses in August and in December Gift is a big part of my expenses. In addition, in December, I spent a lot in Travel/Entertainment due to a planned trip with my family.
###Q5. Compared in Holiday Season month, November and December, what are the differences by amount expensed and category expensed the most?
```{r}
data4<- subset(data, Month %in% c("Nov", "Dec"))
p3<- ggplot(data4, aes(x=Category, y=as.numeric(gsub('[$,]', '', Amount)), color=Month)) +
labs(title = "Amount expensed in November and December", x = "Category", y = "Amount Expensed") +
geom_point(size = 5, alpha = 0.5) +
coord_flip() +
scale_color_manual(name = "Month", labels = c("Nov", "Dec"), values = c("Nov" = "blue", "Dec" = "green")) +
geom_smooth(method = lm, se = 0)
p3
```
***
Compared Amount expensed in November and December, I spent a lot in Travel/Entertainment due to prepaid expenses and paid expense of the planned trip. Meanwhile I spent in Gifts in November to prepare the Gifts for Thanksgiving and Christmas and purchased decorations in Home Supplies to decor the living room.