assoc rules started

This commit is contained in:
LinlyBoi
2021-12-24 23:32:29 +02:00
parent b127e062c2
commit ce800e1600

24
Data.R
View File

@@ -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)
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")