The Quantied Self (QS) is a movement motivated to leverage the synergy of wearables (https://en.wikipedia.org/wiki/Wearable_computer), analytics, and “Big Data”. This movement exploits the ease and convenience of data acquisition through the internet of things (IoT) (https://en.wikipedia.org/wiki/Internet_of_Things) to feed the growing obsession of personal informatics and quotidian (http://www.dictionary.com/browse/quotidian) data. The website http://quanti edself.com/ (http://quanti edself.com/) is a great place to start to understand more about the QS movement.
The value of the QS for our class is that its core mandate is to visualize and generate questions and insights about a topic that is of immense importance to most people - themselves. It also produces a wealth of data in a variety of forms. Therefore, designing this project around the QS movement makes perfect sense because it offers you the opportunity to be both the data and question provider, the data analyst, the vis designer, and the end user. This means you will be in the unique position of being capable of providing feedback and direction at all points along the data visualization/analysis life cycle.
Develop a visualiation dashboard based on a series of data about your own life. The actual data used for this project can range from daily sleep regimes, to spatial positioning information at 1 minute intervals, to blood pressure and nutritient intake. The amount of data you collect and harvest will differ based on your specied objectives. Ultimately the project must meet certain key objectives:
The Data were collected from My Chase travel credit card from 08/01/2016 to 07/31/2017. Visualization methods like histgram, scattorplot, line chart, bar plot, polar coordinates, mapping, and interactive plot. The Tableau and R 3.2.2 were used for visualization.
1.What is the total expense per month from August 2016 to July 2017?
2.What is the total expense per purchase category from August 2016 to July 2017?
3.What is the total expense per location cateogry from August 2016 to July 2017?
4.What is the total daily expense (total expense except tuition and travel) per month from August 2016 to July 2017?
5. What is composition of travel expense from August 2016 to July 2017?
6. What is the top 10 restaurant expense from August 2016 to July 2017?
7. What is the result of comparison between restaurant expense and breakfast/dessert/coffee/snack?
# Input Prepared Quantified Life Dataset
data <- read.csv("C:/Users/xiangyi zhang/Desktop/ANLY 512 Data Visualization/Final Project/Data/Quantified Self.csv")
# 1. Total Expense in Month
summon0 <- aggregate(data$Price, by=list(Category=data$Month),FUN=sum)
summon <- summon0[order(summon0$x),]
library(ggplot2)
ggplot(summon, aes(x=Category, y=x)) +
geom_bar(stat="identity", position="identity", width=.7, colour = "goldenrod2", fill = "gold1") +
scale_x_continuous(name = "Month", breaks = seq(0, 13, 1), limits=c(0, 13)) +
scale_y_continuous(name = "Total Expense", limits=c(0, 10000)) +
ggtitle("Total in Month - 08/01/2016 to 07/31/2017") +
geom_text(aes(label=x), position=position_dodge(width=0.5), vjust=-0.25, size=3) +
theme_bw()
# 2. Purchase Category in Total
sumcat0 <- aggregate(data$Price, by=list(Category=data$Purchase.Category), FUN=sum)
sumcat <- sumcat0[order(sumcat0$x),]
dotchart(sumcat$x, labels=sumcat$Category, cex=0.8, color="blue", main="Sum of Purchase Category - 08/01/2016 to 07/31/2017")
# 3. Price by Location Category
knitr::include_graphics("C:/Users/xiangyi zhang/Desktop/ANLY 512 Data Visualization/Final Project/Data/3. Price by Location Category.png")
# 4. Price by Month Category Except Tuition and Travel
knitr::include_graphics("C:/Users/xiangyi zhang/Desktop/ANLY 512 Data Visualization/Final Project/Data/4. Price by Month Category Except.png")
# 5. Travel
library(mefa)
## Warning: package 'mefa' was built under R version 3.3.3
## mefa 3.2-7 2016-01-11
travel_tr <- sumcat[ which(sumcat$Category=="Travel - Transpotation"),]
count1 <- as.integer(travel_tr$x)
travel_tr_rep <- rep(travel_tr,each=count1)
travel_tr_rep$newname <- "Transpotation"
travel_ti <- sumcat[ which(sumcat$Category=="Travel - Ticket"),]
count2 <- as.integer(travel_ti$x)
travel_ti_rep <- rep(travel_ti,each=count2)
travel_ti_rep$newname <- "Ticket"
travel_ho <- sumcat[ which(sumcat$Category=="Travel - Hotel"),]
count3 <- as.integer(travel_ho$x)
travel_ho_rep <- rep(travel_ho,each=count3)
travel_ho_rep$newname <- "Hotel"
travel_rep <- rbind(travel_tr_rep, travel_ti_rep, travel_ho_rep)
color <- c("lightpink1", "steelblue2", "orange1")
ggplot(travel_rep, aes(x = factor(newname))) +
geom_bar(width = 1, fill=color, colour = "white") +
coord_polar() +
theme(axis.ticks =element_blank(),
axis.text.y =element_blank(),
axis.title=element_blank(),
axis.text.x=element_text(size = 12,angle = 55, face="bold")) +
ggtitle("Travel Expense - 08/01/2016 - 07/31/2017")
# 6. Restaurant Over 150 - Dashboard
knitr::include_graphics("C:/Users/xiangyi zhang/Desktop/ANLY 512 Data Visualization/Final Project/Data/6. Restaurant Over 150 - Dashboard.png")
# 7. Restaurant V.S. BDCS - Interactive Graph
res0 <- data[ which(data$Purchase.Category=="Restaurant "),]
res <- res0[c(2,7)]
res$P_res <- res$Price
dy_res <- res[c(1,3)]
bdcs0 <- data[ which(data$Purchase.Category=="Breakfast & Dessert & Coffee & Snacks"),]
bdcs <- bdcs0[c(2,7)]
bdcs$P_bdcs <- bdcs$Price
dy_bdcs <- bdcs[c(1,3)]
dy <- merge(dy_res, dy_bdcs, by="Date")
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
p<-plot_ly(y=dy$P_res, x=dy$Date , type="scatter", mode="markers+lines", name="Restaurant") %>%
layout(title = "Restaurant V.S. Breakfast/Dessert/Coffee/Snacks - Interactive Graph",
scene = list(
xaxis = list(title = "Date"),
yaxis = list(title = "Price")))
p<-add_trace(p,y=dy$P_bdcs, x=dy$Date , type="scatter", mode="markers+lines", name="BDCS")
p
Comments
Results show that the expense increases dramatically when vocation and traveling came. Most of the expense were in New York. Shopping and eating in the restaurant became the big amount of expense expcept tuition and rent while fitness became the least. The restaurant that I spent the most was Pret A Manger, a place where I could buy breakfast and lunch.