Lab 9: Using exploratory analysis and arules (Answers)

Corey Jackson

2019-11-13 16:47:00

Step 1: Load data

# read in the data
setwd("~/Dropbox/Applied Data Science (IST 687)/Datasets")
load("termDocMatrix.rdata")
# store the data in a new object called "Data"
Data <- termDocMatrix
# check the first 5 rows of the matrix
head(Data,5)

# generate another rulset, setting the RHS to be exactly "analysis"
rules2 <- apriori(df,parameter=list(support=0.01,confidence=0.5),
# support indicate how frequently iterms in LHS and RHS occur together
# confidence indicate how often the rule has found to be true
appearance = list(default="lhs",rhs=c("analysis"))) # set RHS to be "analysis"