Difference between revisions of "ISSS608 2017-18 T3 Assign Yu Zhecheng"
Line 8: | Line 8: | ||
| style="font-family:Century Gothic; font-size:100%; solid #000000; background:#85929E; text-align:center;" width="20%" | | | style="font-family:Century Gothic; font-size:100%; solid #000000; background:#85929E; text-align:center;" width="20%" | | ||
; | ; | ||
− | <font color="#FDFEFE">Background & Preparation</font> | + | [[ISSS608_2017-18_T3_Assign_YU_Zhecheng_Background & Preparation|<font color="#FDFEFE">Background & Preparation</font>]] |
| style="font-family:Century Gothic; font-size:100%; solid #1B338F; background:#85929E; text-align:center;" width="25%" | | | style="font-family:Century Gothic; font-size:100%; solid #1B338F; background:#85929E; text-align:center;" width="25%" | |
Revision as of 14:19, 7 July 2018
|
|
|
|
Contents
Mini Challenge 3 Background
The Kasios Insider has provided data from across the company. There are call records, emails, purchases, and meetings. The data only includes the source of each transaction, the recipient (destination), and the time of the transaction. However, we don't know any details about the content.
There are about 640000 employees work for Kasios. The list contains those who left the company from 2015 to 2017. Although we don't know what they exactly communicated, the users and frequency of all call records, emails, purchases and meetings indicate the development and structure of Kasios. The most important thing is that the suspicious person and activities must left records in the data sets.
Data Preparation
Four Variables
Source: contains the company ID for the person who called, sent an email, purchased something, or invited people to a meeting E-type: contains a number designating what kind of connection is made. a.0 is for calls b.1 is for emails c.2 is for purchases d.3 is for meetings Destination:contains company ID for the person who is receiving a call, receiving an email, selling something to a buyer, or being invited to a meeting. Time stamp:in seconds starting on May 11, 2015 at 14:00.
Nine original data sets
Four data sets that cover the whole company.
Another four data sets of the rest contains the information about individuals that the Insider has indicated as suspicious.
The last company index that shows the name of everyone in the company and their associated ID.
Clean all data sets.
- To transform the time stamp to date, I need the help of R package lubridate. The code is shown below:
x<-ymd_h("2015-5-11 14") emails$timestamp<-x+dseconds(emails$timestamp)
- Because I only care about the date.
emails$date<-ymd(emails$timestamp)
- To overview the development of the whole company. I want to calculate the number of emails,calls,meeting and purchases change over time.
company_emails<-as.data.frame(table(emails$timestamp)) combine all four data sets together to create a new data set which contains the information about the development of the company.
- Because of the numbers between different variables are too big, it's difficult to compare the in the same level.To understand the development of the whole company, I want to scale all numbers in the company.
- To make the data set more easily to analyze, I need to reshape the data structure.
company<-gather(company,attribute,value,-date) companyScale<-gather(companyScale,attribute,value,-date)
- To find out all ID which used to communicate with suspicious. I need to use function merge:
group_emails<-merge(Suspicious_emails,emails,by=c("Source","Destination")) group_calls<-merge(Suspicious_calls,calls,by=c("Source","Destination")) group_purchases<-merge(Suspicious_purchases,purchases,by=c("Source","Destination")) group_meetings<-merge(Suspicious_meetings,meetings,by=c("Source","Destination"))
- To find out all ID which are recorded in 4 new data set, I write a loop.
for (i in CompanyIndex$ID) { if(i %in% group_emails$Source | i %in% group_emails$Destination){temp<-subset(CompanyIndex,CompanyIndex$ID==i) node<-rbind(node,temp) if(i %in% group_calls$Source | i %in% group_calls$Destination){temp<-subset(CompanyIndex,CompanyIndex$ID==i) node<-rbind(node,temp) if(i %in% group_purchases$Source | i %in% group_purchases$Destination){temp<-subset(CompanyIndex,CompanyIndex$ID==i) node<-rbind(node,temp) if(i %in% group_meetings$Source | i %in% group_meetings$Destination){temp<-subset(CompanyIndex,CompanyIndex$ID==i) node<-rbind(node,temp)}
- To explore the communication between all suspicious, I want to merge all three data sets together (group_emails,group_calls,group_meetings).The new data set named edge.