Colored plot for Distrib of spending
Pie for cities (colorised)
This commit is contained in:
14
Data.R
14
Data.R
@@ -11,10 +11,11 @@ library(gridExtra)
|
|||||||
library(ggplot2)
|
library(ggplot2)
|
||||||
library(grid)
|
library(grid)
|
||||||
library(arules)
|
library(arules)
|
||||||
|
library(RColorBrewer)
|
||||||
|
|
||||||
|
|
||||||
#library(cluster)
|
#library(cluster)
|
||||||
|
coul <- brewer.pal(5, "Set2")
|
||||||
|
|
||||||
#Read spreadsheet file
|
#Read spreadsheet file
|
||||||
grocery_entries <- read.csv(file.choose())
|
grocery_entries <- read.csv(file.choose())
|
||||||
@@ -25,13 +26,16 @@ cash_credit <- cbind(grocery_entries[3], grocery_entries[8])
|
|||||||
sum_cash <-sum(cash_credit[which(cash_credit$paymentType=='Cash'),1])
|
sum_cash <-sum(cash_credit[which(cash_credit$paymentType=='Cash'),1])
|
||||||
sum_credit <-sum(cash_credit[which(cash_credit$paymentType=='Credit'),1])
|
sum_credit <-sum(cash_credit[which(cash_credit$paymentType=='Credit'),1])
|
||||||
CompCashCredit <- c(sum_cash,sum_credit)
|
CompCashCredit <- c(sum_cash,sum_credit)
|
||||||
barplot(CompCashCredit,names.arg = c('Cash','Credit'),horiz = FALSE,col = c(rgb(0,1,0),rgb(1,0,0)))
|
barplot(CompCashCredit,names.arg = c('Cash','Credit'),horiz = FALSE,col = coul)
|
||||||
|
|
||||||
#City and Total Spent comparison -Jimmy
|
#City and Total Spent comparison -Jimmy
|
||||||
city_total <- cbind(grocery_entries[3], grocery_entries[7])
|
city_total <- cbind(grocery_entries[3], grocery_entries[7])
|
||||||
sum_cities<-aggregate(total ~city ,city_total,sum)
|
sum_cities<-aggregate(total ~city ,city_total,sum)
|
||||||
|
pie(sum_cities$total
|
||||||
|
,col = coul
|
||||||
|
,labels = sum_cities$city
|
||||||
|
,main = "Cities and total spent")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#Compare between ages and their total spent (Youssri)
|
#Compare between ages and their total spent (Youssri)
|
||||||
@@ -42,6 +46,7 @@ plot(sum_ages)
|
|||||||
|
|
||||||
#Distribution of spending - Abdo
|
#Distribution of spending - Abdo
|
||||||
|
|
||||||
|
plot(grocery_entries$total, col = coul,type = "l", main = "spending")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -52,6 +57,7 @@ keameans<-cbind(grocery_entries[3],grocery_entries[6])
|
|||||||
result<-kmeans(keameans,centers =n)
|
result<-kmeans(keameans,centers =n)
|
||||||
final_result<-cbind(name_total_age,result$cluster)
|
final_result<-cbind(name_total_age,result$cluster)
|
||||||
|
|
||||||
|
|
||||||
#Association Rules --Sewelam
|
#Association Rules --Sewelam
|
||||||
clean_data <- grocery_entries[,-5]
|
clean_data <- grocery_entries[,-5]
|
||||||
minsup <- as.numeric(readline("Enter minimum support: "))
|
minsup <- as.numeric(readline("Enter minimum support: "))
|
||||||
|
|||||||
Reference in New Issue
Block a user