Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- title: "A20 by Noah Perry & Andrew Hall"
- output: html_notebook
- ---
- Use Association Rules to do a market basket analysis for Superstore Sales. As a result of your analysis, what advice would you give to Superstore Sales?
- ```{r}
- library(readxl)
- library(arules)
- library(arulesViz)
- url <- "https://community.tableau.com/servlet/JiveServlet/downloadBody/1236-102-2-15278/Sample%20-%20Superstore.xls"
- destfile <- "Sample_20_20Superstore.xls"
- curl::curl_download(url, destfile)
- ss <- read_excel(destfile)
- #ss <- as (ss, "transactions") # convert to 'transactions' class
- write.csv(ss,'superstore.csv')
- #convert to transactions file
- models <- read.transactions(file = "superstore.csv",
- sep=",", format = 'single', cols = c(1,19))
- summary(models)
- size(head(models))
- LIST(head(models))
- #Identify Frequent Item Sets
- frequentItems <- eclat (models, parameter = list(supp = 0.08, maxlen = 5))
- inspect(frequentItems)
- itemFrequencyPlot(models, topN=10, type="absolute", main="Item Frequency")
- #Identify Rules
- rules <- apriori (models, parameter = list(supp = 0.06, conf = .7, maxlen = 3))
- rules_conf <- sort (rules, by="confidence", decreasing=TRUE)
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement