Análisis de las ventas en abarrotes
Instalar paquetes y llamar librerías
library(plyr)
library(Matrix)
library(arules)
##
## Attaching package: 'arules'
## The following objects are masked from 'package:base':
##
## abbreviate, write
library(arulesViz)
library(datasets)
Importar la base de datos
bd_limpia<-read.csv("C:\\Users\\AVRIL\\Documents\\Abarrotes_bdlimpia_A00833113.csv")
Ordenar de menor a mayor los tickets
bd_limpia<-bd_limpia[order(bd_limpia$F.Ticket),]
head(bd_limpia)
## vcClaveTienda DescGiro Fecha Hora Marca
## 1 MX001 Abarrotes 19/06/2020 8 NUTRI LECHE
## 2 MX001 Abarrotes 19/06/2020 8 DAN UP
## 3 MX001 Abarrotes 19/06/2020 8 BIMBO
## 4 MX001 Abarrotes 19/06/2020 8 PEPSI
## 5 MX001 Abarrotes 19/06/2020 8 BLANCA NIEVES (DETERGENTE)
## 6 MX001 Abarrotes 19/06/2020 8 FLASH
## Fabricante Producto Precio
## 1 MEXILAC Nutri Leche 1 Litro 16.0
## 2 DANONE DE MEXICO DANUP STRAWBERRY P/BEBER 350GR NAL 14.0
## 3 GRUPO BIMBO Rebanadas Bimbo 2Pz 5.0
## 4 PEPSI-COLA MEXICANA Pepsi N.R. 400Ml 8.0
## 5 FABRICA DE JABON LA CORONA Detergente Blanca Nieves 500G 19.5
## 6 ALEN Flash Xtra Brisa Marina 500Ml 9.5
## Ult.Costo Unidades F.Ticket NombreDepartamento NombreFamilia
## 1 12.31 1 1 Abarrotes Lacteos y Refrigerados
## 2 14.00 1 2 Abarrotes Lacteos y Refrigerados
## 3 5.00 1 3 Abarrotes Pan y Tortilla
## 4 8.00 1 3 Abarrotes Bebidas
## 5 15.00 1 4 Abarrotes Limpieza del Hogar
## 6 7.31 1 4 Abarrotes Limpieza del Hogar
## NombreCategoria Estado Mts.2 Tipo.ubicación Giro
## 1 Leche Nuevo León 60 Esquina Abarrotes
## 2 Yogurt Nuevo León 60 Esquina Abarrotes
## 3 Pan Dulce Empaquetado Nuevo León 60 Esquina Abarrotes
## 4 Refrescos Plástico (N.R.) Nuevo León 60 Esquina Abarrotes
## 5 Lavandería Nuevo León 60 Esquina Abarrotes
## 6 Limpiadores Líquidos Nuevo León 60 Esquina Abarrotes
## Hora.inicio Hora.cierre diadelasemana subtotal
## 1 08:00 22:00 6 16.0
## 2 08:00 22:00 6 14.0
## 3 08:00 22:00 6 5.0
## 4 08:00 22:00 6 8.0
## 5 08:00 22:00 6 19.5
## 6 08:00 22:00 6 9.5
tail(bd_limpia)
## vcClaveTienda DescGiro Fecha Hora Marca
## 107247 MX004 Carnicería 15/10/2020 11 YEMINA
## 167624 MX004 Carnicería 15/10/2020 11 DEL FUERTE
## 149282 MX004 Carnicería 15/10/2020 11 COCA COLA ZERO
## 168603 MX004 Carnicería 15/10/2020 11 DIAMANTE
## 161046 MX004 Carnicería 15/10/2020 12 PEPSI
## 112823 MX004 Carnicería 15/10/2020 12 COCA COLA
## Fabricante Producto Precio Ult.Costo
## 107247 HERDEZ PASTA SPAGHETTI YEMINA 200G 7 5.38
## 167624 ALIMENTOS DEL FUERTE PURE DE TOMATE DEL FUERTE 345G 12 9.23
## 149282 COCA COLA COCA COLA ZERO 600ML 15 11.54
## 168603 EMPACADOS ARROZ DIAMANTE225G 11 8.46
## 161046 PEPSI-COLA MEXICANA PEPSI N. R. 500ML 10 7.69
## 112823 COCA COLA COCA COLA RETORNABLE 500ML 10 7.69
## Unidades F.Ticket NombreDepartamento NombreFamilia
## 107247 2 450032 Abarrotes Sopas y Pastas
## 167624 1 450032 Abarrotes Salsas y Sazonadores
## 149282 2 450034 Abarrotes Bebidas
## 168603 1 450037 Abarrotes Granos y Semillas
## 161046 1 450039 Abarrotes Bebidas
## 112823 8 450040 Abarrotes Bebidas
## NombreCategoria Estado Mts.2 Tipo.ubicación Giro
## 107247 Fideos, Spaguetti, Tallarines Sinaloa 53 Esquina Abarrotes
## 167624 Salsa para Spaguetti Sinaloa 53 Esquina Abarrotes
## 149282 Refrescos Retornables Sinaloa 53 Esquina Abarrotes
## 168603 Arroz Sinaloa 53 Esquina Abarrotes
## 161046 Refrescos Plástico (N.R.) Sinaloa 53 Esquina Abarrotes
## 112823 Refrescos Retornables Sinaloa 53 Esquina Abarrotes
## Hora.inicio Hora.cierre diadelasemana subtotal
## 107247 07:00 23:00 5 14
## 167624 07:00 23:00 5 12
## 149282 07:00 23:00 5 30
## 168603 07:00 23:00 5 11
## 161046 07:00 23:00 5 10
## 112823 07:00 23:00 5 80
Extraer productos por ticket
basket <- ddply(bd_limpia, c("F.Ticket"), function(bd_limpia)paste(bd_limpia$Marca,collapse=","))
Eliminar número de ticker
basket$F.Ticket<-NULL
Renombrar columnas
colnames(basket)<-c("Marca")
Exportar basket
write.csv(basket,"basket.csv", quote = FALSE, row.names = FALSE)
Importar transacciones
tr<-read.transactions("C:\\Users\\AVRIL\\Documents\\Basket.csv", format="basket",sep=",")
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in scan(text = l, what = "character", sep = sep, quote = quote, : EOF
## within quoted string
## Warning in asMethod(object): removing duplicated items in transactions
Generar reglas de asociación
reglas_asociacion<-apriori(tr, parameter = list(supp=0.001, conf=0.2, maxlen=10))
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.2 0.1 1 none FALSE TRUE 5 0.001 1
## maxlen target ext
## 10 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 115
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[604 item(s), 115031 transaction(s)] done [0.05s].
## sorting and recoding items ... [207 item(s)] done [0.00s].
## creating transaction tree ... done [0.03s].
## checking subsets of size 1 2 3 done [0.00s].
## writing ... [11 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
summary(reglas_asociacion)
## set of 11 rules
##
## rule length distribution (lhs + rhs):sizes
## 2
## 11
##
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2 2 2 2 2 2
##
## summary of quality measures:
## support confidence coverage lift
## Min. :0.001017 Min. :0.2069 Min. :0.003564 Min. : 1.326
## 1st Qu.:0.001104 1st Qu.:0.2358 1st Qu.:0.004507 1st Qu.: 1.789
## Median :0.001417 Median :0.2442 Median :0.005807 Median : 3.972
## Mean :0.001521 Mean :0.2537 Mean :0.006056 Mean :17.558
## 3rd Qu.:0.001652 3rd Qu.:0.2685 3rd Qu.:0.006894 3rd Qu.:21.808
## Max. :0.002747 Max. :0.3098 Max. :0.010502 Max. :65.862
## count
## Min. :117.0
## 1st Qu.:127.0
## Median :163.0
## Mean :174.9
## 3rd Qu.:190.0
## Max. :316.0
##
## mining info:
## data ntransactions support confidence
## tr 115031 0.001 0.2
## call
## apriori(data = tr, parameter = list(supp = 0.001, conf = 0.2, maxlen = 10))
inspect(reglas_asociacion)
## lhs rhs support confidence coverage
## [1] {FANTA} => {COCA COLA} 0.001051890 0.2439516 0.004311881
## [2] {SALVO} => {FABULOSO} 0.001104050 0.3097561 0.003564257
## [3] {FABULOSO} => {SALVO} 0.001104050 0.2347505 0.004703080
## [4] {COCA COLA ZERO} => {COCA COLA} 0.001417009 0.2969035 0.004772627
## [5] {SPRITE} => {COCA COLA} 0.001347463 0.2069426 0.006511288
## [6] {PINOL} => {CLORALEX} 0.001017117 0.2368421 0.004294495
## [7] {BLUE HOUSE} => {BIMBO} 0.001712582 0.2720994 0.006293956
## [8] {HELLMANN´S} => {BIMBO} 0.001538716 0.2649701 0.005807130
## [9] {REYMA} => {CONVERMEX} 0.002095087 0.2441743 0.008580296
## [10] {FUD} => {BIMBO} 0.001590876 0.2186380 0.007276299
## [11] {COCA COLA LIGHT} => {COCA COLA} 0.002747086 0.2615894 0.010501517
## lift count
## [1] 1.562646 121
## [2] 65.862391 127
## [3] 65.862391 127
## [4] 1.901832 163
## [5] 1.325583 155
## [6] 25.063647 117
## [7] 4.078691 197
## [8] 3.971823 177
## [9] 18.551922 241
## [10] 3.277319 183
## [11] 1.675626 316
reglas_asociacion <- sort(reglas_asociacion, by="confidence", decreasing=TRUE)
summary(reglas_asociacion)
## set of 11 rules
##
## rule length distribution (lhs + rhs):sizes
## 2
## 11
##
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2 2 2 2 2 2
##
## summary of quality measures:
## support confidence coverage lift
## Min. :0.001017 Min. :0.2069 Min. :0.003564 Min. : 1.326
## 1st Qu.:0.001104 1st Qu.:0.2358 1st Qu.:0.004507 1st Qu.: 1.789
## Median :0.001417 Median :0.2442 Median :0.005807 Median : 3.972
## Mean :0.001521 Mean :0.2537 Mean :0.006056 Mean :17.558
## 3rd Qu.:0.001652 3rd Qu.:0.2685 3rd Qu.:0.006894 3rd Qu.:21.808
## Max. :0.002747 Max. :0.3098 Max. :0.010502 Max. :65.862
## count
## Min. :117.0
## 1st Qu.:127.0
## Median :163.0
## Mean :174.9
## 3rd Qu.:190.0
## Max. :316.0
##
## mining info:
## data ntransactions support confidence
## tr 115031 0.001 0.2
## call
## apriori(data = tr, parameter = list(supp = 0.001, conf = 0.2, maxlen = 10))
inspect(reglas_asociacion)
## lhs rhs support confidence coverage
## [1] {SALVO} => {FABULOSO} 0.001104050 0.3097561 0.003564257
## [2] {COCA COLA ZERO} => {COCA COLA} 0.001417009 0.2969035 0.004772627
## [3] {BLUE HOUSE} => {BIMBO} 0.001712582 0.2720994 0.006293956
## [4] {HELLMANN´S} => {BIMBO} 0.001538716 0.2649701 0.005807130
## [5] {COCA COLA LIGHT} => {COCA COLA} 0.002747086 0.2615894 0.010501517
## [6] {REYMA} => {CONVERMEX} 0.002095087 0.2441743 0.008580296
## [7] {FANTA} => {COCA COLA} 0.001051890 0.2439516 0.004311881
## [8] {PINOL} => {CLORALEX} 0.001017117 0.2368421 0.004294495
## [9] {FABULOSO} => {SALVO} 0.001104050 0.2347505 0.004703080
## [10] {FUD} => {BIMBO} 0.001590876 0.2186380 0.007276299
## [11] {SPRITE} => {COCA COLA} 0.001347463 0.2069426 0.006511288
## lift count
## [1] 65.862391 127
## [2] 1.901832 163
## [3] 4.078691 197
## [4] 3.971823 177
## [5] 1.675626 316
## [6] 18.551922 241
## [7] 1.562646 121
## [8] 25.063647 117
## [9] 65.862391 127
## [10] 3.277319 183
## [11] 1.325583 155
top10reglas <- head(reglas_asociacion, n=10, by="confidence")
plot(top10reglas, method="graph", engine="htmlwidget")
#Estrategias de Negocio
#1. Asignarmarcas cercanas en el anaquel: Salvo & Fabuloso
#2. Promocion en Reyma, Pinol, Queso/Jamon/Mayonesa,
Zero/Light/Fanta
#3. Realizar Business Case para venta de sandwiches preparados.
#4. Asignar marcas alejadas para recorre la tienda