January 2018
Beginner to intermediate
412 pages
9h 33m
English
The Apriori algorithm, as explained earlier, allows users to find relationships or patterns inherent in a dataset. For this, we will use the arules package in R/RStudio. The code will read the dataset downloaded (called cms2016_2.csv in the example) and run the apriori algorithm in order to find associative rules.
Create a new R file in RStudio and enter the following code. Make sure that you change the location of the csv file that you downloaded to the appropriate directory where the file has been stored:
library(data.table) library(arules) cms<- fread("~/cms2016_2.csv") # CHANGE THIS TO YOUR LOCATION OF THE DATA cols <- c("category","city","company","firstName","lastName","paymentNature","product") cms[ ,(cols) ...Read now
Unlock full access