Fixed bar plot!
This commit is contained in:
21
Data.R
21
Data.R
@@ -1,6 +1,7 @@
|
|||||||
# Installing Packages
|
# Installing Packages
|
||||||
#install.packages("ClusterR")
|
#install.packages("ClusterR")
|
||||||
install.packages("cluster")
|
#Run install.packages if you haven't installed it before (only once)
|
||||||
|
#install.packages("cluster")
|
||||||
|
|
||||||
# Loading package
|
# Loading package
|
||||||
#library(ClusterR)
|
#library(ClusterR)
|
||||||
@@ -9,21 +10,31 @@ library(cluster)
|
|||||||
#Read spreadsheet file
|
#Read spreadsheet file
|
||||||
grocery_entries <- read.csv(file.choose())
|
grocery_entries <- read.csv(file.choose())
|
||||||
|
|
||||||
#Compare cash and credit totals
|
#Compare cash and credit totals -Sewelam
|
||||||
|
|
||||||
cash_credit <- cbind(grocery_entries[3], grocery_entries[8])
|
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 = ((0,100,0),(100,0,0)))
|
barplot(CompCashCredit,names.arg = c('Cash','Credit'),horiz = FALSE,col = c(rgb(0,1,0),rgb(1,0,0)))
|
||||||
|
|
||||||
|
#City and Total Spent comparison -Jimmy
|
||||||
|
|
||||||
|
|
||||||
#please visualise the data I am lazy - Sewelam
|
|
||||||
|
|
||||||
#Compare between ages and their total spent
|
|
||||||
|
|
||||||
|
|
||||||
|
#Compare between ages and their total spent (Youssri)
|
||||||
ages <- cbind(grocery_entries[6] , grocery_entries[3])
|
ages <- cbind(grocery_entries[6] , grocery_entries[3])
|
||||||
sum_ages <- aggregate(total ~ age,ages,sum)
|
sum_ages <- aggregate(total ~ age,ages,sum)
|
||||||
plot(sum_ages)
|
plot(sum_ages)
|
||||||
|
|
||||||
|
|
||||||
|
#Distribution of spending - Abdo
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user