Overview of the Quantified Self movement

The Quantified Self movement grew from the popularity and growth of the internet of things, the mass collection of personal information, and mobile technologies (primarily wearable computing). It is aboout new discoveries about ourselves and our communities that are grounded in accurate observation and enlivened by a spirit of friendship.This final class project uses a collection of 6 months of data on spending and payments captured by my credit card.Let see the Questions which I am going to analyse for my credit card spend in the last six months.

Five Questions

The main aim of the project is to analyze and visualize the data using the tools and methods covered in 512 class.Using the data driven approach, I analyzed some of the thought which came into my mind. The thoughts which I analyzed first I transafered into questions which are as follows:

  1. What is the total spending by month in 2018?
  2. Which category costed the most in 2018?
  3. For Merchandise, what is the spending by month in 2018?
  4. In August and September, what is the spending in each category?
  5. What is my frequency of using credit card?

These questions are all based on my credit card transactions for last 6 months.Now let see how the data looks which I collected from my credit card transactions, these datas are easily available in almost all credit card online profile.

Data Preparation

Before finalizing the variables I first renamed and variables name and transfered the date into month category for easily visualization of the grapgh and plot. After all these manipulation,the final variables are

Data set

Credit_Card Sample raw data in 2018
Trans.date Description Amount Category Detail Month Category
04/03/2018 AUX*LiveCareer - 800-652-8430, LU 1.00 Merchandise & Supplies-Internet Purchase 4 Merchandise
04/03/2018 AUX*LiveCareer - 800-652-8430, LU 1.95 Merchandise & Supplies-Internet Purchase 4 Merchandise
04/16/2018 SCRIBD INC - SAN FRANCISCO 8.99 Merchandise & Supplies-Internet Purchase 4 Merchandise
04/16/2018 SCRIBD INC - SAN FRANCISCO 8.99 Merchandise & Supplies-Internet Purchase 4 Merchandise
04/18/2018 AUX*LiveCareer - 800-652-8430, LU 24.95 Merchandise & Supplies-Internet Purchase 4 Merchandise
04/18/2018 CHEGG, INC. - SANTA CLARA, CA 15.94 Merchandise & Supplies-Book Stores 4 Merchandise
04/18/2018 CHEGG, INC. - SANTA CLARA, CA 15.94 Merchandise & Supplies-Book Stores 4 Merchandise
04/19/2018 ADJ PURCHASE FIN CHG 1.43 Fees & Adjustments-Fees & Adjustments 4 Fees & Adjustments
04/19/2018 ADJ PURCHASE FIN CHG 0.03 Fees & Adjustments-Fees & Adjustments 4 Fees & Adjustments
04/19/2018 CR ADJ FOR FINANCE CHARGE 0.83 Fees & Adjustments-Fees & Adjustments 4 Fees & Adjustments
04/19/2018 Interest Charge on Promotional Balances 61.10 Fees & Adjustments-Fees & Adjustments 4 Fees & Adjustments
04/19/2018 Interest Charge on Purchases 95.03 Fees & Adjustments-Fees & Adjustments 4 Fees & Adjustments
04/23/2018 LYCAMOBILE USA INC.. LYCAMOBILE USA - LONDON 27.41 Merchandise & Supplies-Internet Purchase 4 Merchandise
04/30/2018 MOVIEPASS, INC MOVIEPASS, INC - NEW YORK, NY 9.95 Entertainment-General Events 4 Entertainment
04/30/2018 MOVIEPASS, INC MOVIEPASS, INC - NEW YORK, NY 9.95 Entertainment-General Events 4 Entertainment

What is the total spending by month in 2018 ?

[1] 426.5057

I have to compare the total expense in each month,therefore bar chart was used to summarize the data.I summarized the total amount spent in each month and used bar chart to display the numbers. From the plot we could find that, average spending over month is around 430 dollars. Total spending in July and August are the most.

Which category costed the most in 2018?


As july is my highest spending month. July spend was higher than August, mainly due to spending more in fees and Merchandise. It’s worth noting that October data is only of 10 days the month, but it’s already 3/4 of my April spend, so it looks like it could cross september or august month expense.

It was very interesting for me to look at the changes in categories month to month. For example, Transportation expense looks highest in month of august and merchandise expense increased from the month of August.This make sense to me as prior to august I was living as paying guest so not much merchandise purcahase before August

For Merchandise, what is the spending by month in 2018?


We see that for most months, the spending on Merchandise was less than 40 dollars pertransaction . However, in August and September, consolidated spending was around 3 times higher than the other months.

In August and September, what is the spending in each category?


From the plot we can see that, After fees, the most spending is Merchandise. Besides,in August, the second spending is Transportation, whereas in september the second highest is Restaurant.

What is my frequency of using credit card?


I made the most number of transactions in September, which is not my highest-spending month. Also, when comparing this line graph with my month-by-month dollar spend, I think in july I made fewer purchases but they were larger ones, whereas in june I made more transactions but ended up spending less than in july. You can hover over the line graph to get the exact number of transactions each month.

---
title: "ANLY 512 Final Project"
author: "Kumar Rohan"
date: "Oct 12, 2018"
output: 
   flexdashboard::flex_dashboard:
    orientation: columns
    social: menu
    storyboard: true
    source: embed
    vertical_layout: fill
---

```{r setup, include=FALSE}

pckgs<-c("dplyr","colorspace","tidyverse","tidyquant","ggplot", "ggthemes", "flexdashboard","knitr","xts","readxl","zoo","plotly","withr")

install.packages(pckgs,repos = "http://cran.us.r-project.org")


library(flexdashboard)
library(ggplot2)
library(knitr)
library(tidyverse)
library(readxl)
library(xts)
library(zoo)
library(plotly)
setwd("C:\\Users\\Rohan Singh\\R practise\\512\\Project")

```

### Overview of the Quantified Self movement

The Quantified Self movement grew from the popularity and growth of the internet of things, the mass collection of personal information, and mobile technologies (primarily wearable computing). It is aboout new discoveries about ourselves and our communities that are grounded in accurate observation and enlivened by a spirit of friendship.This final class project uses a collection of 6 months of data on spending and payments captured by my credit card.Let see the Questions which I am going to analyse for my credit card spend in the last six months. 

### Five Questions

The main aim of the project is to analyze and visualize the data using the tools and methods covered in 512 class.Using the data driven approach, I analyzed some of the thought which came into my mind. The thoughts which I analyzed first I transafered into questions which are as follows:


1) What is the total spending by month in 2018?
2) Which category costed the most in 2018?
3) For Merchandise, what is the spending by month in 2018?
4) In August and September, what is the spending in each category?
5) What is my frequency of using credit card?

These questions are all based on my credit card transactions for last 6 months.Now let see how the data looks which I collected from my credit card transactions, these datas are easily available in almost all credit card online profile.


### Data Preparation

Before finalizing the variables I first renamed and variables name and transfered the date into month category for easily visualization of the grapgh and plot. After all these manipulation,the final variables are


- Tran.date: Transaction Date
- Description: Detailed Description of purchases
- Amount: The total amount spent
- Month
- Category


### Data set
```{r}

Credit_Card <- read_excel("C:/Users/Rohan Singh/R practise/512/Project/ExpenseData.xlsx", 
                                         sheet = "Credit_Card")

kable(Credit_Card[1:15,], caption="Credit_Card Sample raw data in 2018")

```


### What is the total spending by month in 2018 ?


```{r}
fill <- "gold1"
line <- "goldenrod2"
Credit_CardSpending<- ggplot(Credit_Card, aes(x = Month, y=Amount)) + 
  geom_bar(stat = "identity", fill = "Red")+
  scale_x_discrete(limits=c("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")) +
  labs(title = "Credit Card Spending per Month", x = "Month", y = "Amount") +
  theme_minimal()
Credit_CardSpending
sum(Credit_Card$Amount)/7

```


***

I have to compare the total expense in each month,therefore bar chart was used to summarize the data.I summarized the total amount spent in each month and used bar chart to display the numbers.
From the plot we could find that, average spending over month is around 430 dollars. Total spending in July and August are the most.

### Which category costed the most in 2018? 

```{r}

Creditcard_Vis <- ggplot(Credit_Card, aes(x=Month, y=Amount)) +   
  geom_bar(aes(fill = Category),  stat="identity") +
  labs(title = "Spend by Month and Category", x = "Month", y = "Amount") +
  scale_x_continuous(breaks=c(4,5,6,7,8,9,10)) +
  theme(legend.position = "Right") +
  scale_fill_discrete(name="Category") +
  theme(legend.position = "right")

Creditcard_Vis

#month <- ggplot(boadata, aes(x=Date, y=Amount)) + 
  #geom_area(aes(color = "#00AFBB", fill="#00AFBB"),
                 #alpha = 0.5, position=position_dodge(0.8))

```

***


As july is my highest spending month. July spend was higher than August, mainly due to spending more in fees and Merchandise. It's worth noting that October data is only of 10 days the month, but it's already 3/4 of my April spend, so it looks like it could cross september or august month expense. 

It was very interesting for me to look at the changes in categories month to month. For example, Transportation expense looks highest in month of august and merchandise expense increased from the month of August.This make sense to me as prior to august I was living as paying guest so not much merchandise purcahase before August 


### For Merchandise, what is the spending by month in 2018?

```{r}
library(plotly)
data3<- subset(Credit_Card, Category=='Merchandise')
CreditCard_Merchandise<- ggplot(data3, aes(x=Month, y=Amount, Trans.date=Trans.date, Category=Category)) +
  geom_point(aes(col=Amount, size=Amount)) +
  labs(title = "Spending per Month", x = "Month", y = "Amount")

(ggCreditCard_Merchandise <- ggplotly(CreditCard_Merchandise, tooltip = c("Post_Date", "y", "Vendor")))

ggCreditCard_Merchandise

```

***


We see that for most months, the spending on Merchandise was less than 40 dollars pertransaction . However, in August and September, consolidated spending was around 3 times higher than the other months.

### In August and September, what is the spending in each category?
 

```{r}

data_aug<- subset(Credit_Card, Month=='8')
P1<- ggplot(Credit_Card, aes(x = Category, y = Amount)) +
  geom_bar(stat = "identity", fill = "Dark Blue")+
  labs(title = "August Spending per Category", x = "Category", y = "Amount") +
  coord_flip()
P1


data_sep<- subset(Credit_Card, Month=='9' )
P2<- ggplot(data_sep, aes(x = Category, y=Amount, fill=Category)) + 
  geom_bar(stat = "identity", fill = "Dark Green")+
  labs(title = " September Spending per Category", x = "Category", y = "Amount") +
  coord_flip()
P2

```

***


From the plot we can see that, After fees, the most spending is Merchandise. 
Besides,in August, the second spending is Transportation, whereas in september the 
second highest is Restaurant.


### What is my frequency of using credit card?


```{r}
library(plotly)
Creditcard <- ggplot(Credit_Card, aes(x=Month)) +
  stat_count(geom='line', aes(y=..count..)) +
  labs(title = "Transactions", x = "Month", y = "Count")

(ggcard <- ggplotly(Creditcard))

```

***

I made the most number of transactions in September, which is not my highest-spending month. Also, when comparing this line graph with my month-by-month dollar spend, I think in july  I made fewer purchases but they were larger ones, whereas in june I made more transactions but ended up spending less than in july. You can hover over the line graph to get the exact number of transactions each month.