Formatting the code and tidying up!!!
This commit is contained in:
28
Data.R
28
Data.R
@@ -1,23 +1,29 @@
|
|||||||
# Installing Packages
|
# Installing Packages
|
||||||
install.packages("ClusterR")
|
#install.packages("ClusterR")
|
||||||
install.packages("cluster")
|
install.packages("cluster")
|
||||||
|
|
||||||
# Loading package
|
# Loading package
|
||||||
library(ClusterR)
|
#library(ClusterR)
|
||||||
library(cluster)
|
library(cluster)
|
||||||
|
|
||||||
|
#Read spreadsheet file
|
||||||
grocery_entries <- read.csv(file.choose())
|
grocery_entries <- read.csv(file.choose())
|
||||||
#grocery_entries <- read_excel("~/College/Data Science/Project/grc.xlsx")
|
|
||||||
cash_credit <- cbind(grocery_entries[3], grocery_entries[8])
|
|
||||||
#
|
|
||||||
#sum_cash <-sum(cash_credit[which(cash_credit$paymentType=='Cash'),1])
|
|
||||||
#sum_credit <-sum(cash_credit[which(cash_credit$paymentType=='Credit'),1])
|
|
||||||
|
|
||||||
#CompCashCredit <- c(sum_cash,sum_credit)
|
#Compare cash and credit totals
|
||||||
|
|
||||||
|
cash_credit <- cbind(grocery_entries[3], grocery_entries[8])
|
||||||
|
sum_cash <-sum(cash_credit[which(cash_credit$paymentType=='Cash'),1])
|
||||||
|
sum_credit <-sum(cash_credit[which(cash_credit$paymentType=='Credit'),1])
|
||||||
|
CompCashCredit <- c(sum_cash,sum_credit)
|
||||||
|
barplot(CompCashCredit,names.arg = c('Cash','Credit'),horiz = FALSE,col = ((0,100,0),(100,0,0)))
|
||||||
|
|
||||||
|
|
||||||
#please visualise the data I am lazy - Sewelam
|
#please visualise the data I am lazy - Sewelam
|
||||||
|
|
||||||
|
#Compare between ages and their total spent
|
||||||
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)
|
||||||
#First Github Commitment! 23
|
|
||||||
#Don't be lazy swelam --Yousri
|
|
||||||
table()
|
|
||||||
|
|||||||
Reference in New Issue
Block a user