diff --git a/Data.R b/Data.R index a7e8307..0b6242d 100644 --- a/Data.R +++ b/Data.R @@ -1,11 +1,16 @@ # Installing Packages -#install.packages("ClusterR") +#install.packages('gridExtra') #Run install.packages if you haven't installed it before (only once) #install.packages("cluster") - +#install.packages('ggplot2') # Loading package #library(ClusterR) library(cluster) +library(gridExtra) +library(ggplot2) +library(grid) +library(arules) + #Read spreadsheet file grocery_entries <- read.csv(file.choose()) @@ -38,7 +43,18 @@ plot(sum_ages) #kmeans --Yousri name_total_age<-cbind(grocery_entries[5],grocery_entries[3],grocery_entries[6]) -#x<-readline() +k<-readline("Enter number of clusters: ") keameans<-cbind(grocery_entries[3],grocery_entries[6]) -result<-kmeans(keameans,centers = 10) -final_result<-cbind(name_total_age,result$cluster) \ No newline at end of file +result<-kmeans(keameans,centers = k) +final_result<-cbind(name_total_age,result$cluster) + + + + + + +#Association Rules --Sewelam +minsup <- readline("Enter minimum support: ") +minconf <- readline("Enter minimum confidence: ") +asoc_rules <- apriori(,parameter = list(supp = minsup,conf = minconf)) +write.csv(as(asoc_rules,"data.frame"),file = "pog.csv") \ No newline at end of file