Arca Continental implementó un nuevo modelo de negocio. Este consiste en apoyar a los abarroteros que durante muchos años fueron sus principales aliados comerciales, les ayudaron a diferenciarse de la competencia, a automatizar su negocio, entre muchas otras cosas.
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.3 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.3 ✔ tibble 3.2.1
## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
##
## Attaching package: 'janitor'
##
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test
library(dplyr)
#count(df, Territorio, sort=TRUE)
#count(df, Sub.Territorio, sort=TRUE)
#count(df, CEDI, sort=TRUE)
#count(df, cliente, sort=TRUE)
#count(df, Nombre, sort=TRUE)
#count(df, Tamaño.Cte.Industria, sort=TRUE)
#count(df, Segmento.Det, sort=TRUE)
#count(df, Marca, sort=TRUE)
count(df, Presentacion, sort=TRUE)## Presentacion n
## 1 600 ml NR 74008
## 2 1 Ltro. N.R. 36930
## 3 2 Lts. NR 36415
## 4 500 ml Ret 35165
## 5 1.5 Lts. NR 30637
## 6 Lata 235 ml 24551
## 7 400 ml NR 22877
## 8 250 ml. NR PET 21735
## 9 500 ml NR Vidrio 18758
## 10 2.5 Lts. NR 13235
## 11 Lata 11810
## 12 200 ml Tetra 11190
## 13 500 ml NR PET 11022
## 14 1 Ltro. Tetra 10580
## 15 235 ml NR Vid 10476
## 16 12 Oz. NR Pet 9906
## 17 1.5 Lts. Ret 8398
## 18 413 ml NR VId 8292
## 19 Lata 16 Oz. 7792
## 20 12 Oz. Ret 7373
## 21 2.5 Lts. Ret Pet 7161
## 22 250 ml Tetra 6121
## 23 1.250 Lts NR 4741
## 24 300 ML. NR PET 4356
## 25 8 Oz. NR 3876
## 26 1.750 Lts NR 3687
## 27 237 ml NR Pet 3611
## 28 250 ML. NR VID 3184
## 29 946 ml NR Tetra 3183
## 30 2 Lts. Ret 2501
## 31 5 Lts. NR 2253
## 32 1 Ltro Ret. 2111
## 33 Lata 450 ml 1505
## 34 Lata 453 ml 1269
## 35 125 ml NR Tetra 1093
## 36 355 Ml NR Pet 670
## 37 Lata 335 ml 586
## 38 6.5 Oz. Ret 573
## 39 Lata 340 ml 563
## 40 Lata 222 ml 499
## 41 473 ml NR 320
## 42 100 ml NR Tetra 285
## 43 237 ml NR Vid 238
## 44 Lata 8 OZ. 230
## 45 12 Oz. NR Vidrio 195
## 46 710 ml NR 172
## 47 LATA 680 ML 151
## 48 3 Lts. NR 145
## 49 750 ml NR Tetra 32
## 50 350 ML NR PET 16
## 51 Lata 237 ml 13
## 52 Bag In Box 6
## 53 Sobres 907 grs 6
## 54 251ml NR Alum 3
## 55 200 ml NR 2
## 56 Lata 310 ml 1
## 57 Presentacion 1
## Tamaño n
## 1 Individual 328513
## 2 Familiar 137995
## 3 Tamaño 1
## Retornable_NR n
## 1 No Retornable 403226
## 2 Retornable 63282
## 3 Retornable_NR 1
## ID Año Territorio Sub.Territorio
## Min. : 1 Min. :2016 Length:466509 Length:466509
## 1st Qu.:116628 1st Qu.:2017 Class :character Class :character
## Median :233255 Median :2018 Mode :character Mode :character
## Mean :233255 Mean :2018
## 3rd Qu.:349882 3rd Qu.:2019
## Max. :466509 Max. :2019
## CEDI Cliente Nombre Tamaño.Cte.Industria
## Length:466509 Length:466509 Length:466509 Length:466509
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## Segmento.Det Marca Presentacion Tamaño
## Length:466509 Length:466509 Length:466509 Length:466509
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## Retornable_NR Enero Febrero Marzo
## Length:466509 Length:466509 Length:466509 Length:466509
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## Abril Mayo Junio Julio
## Length:466509 Length:466509 Length:466509 Length:466509
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## Agosto Septiembre Octubre Noviembre
## Length:466509 Length:466509 Length:466509 Length:466509
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## Diciembre
## Length:466509
## Class :character
## Mode :character
##
##
##
## 'data.frame': 466509 obs. of 25 variables:
## $ ID : int 1 2 3 4 5 6 7 8 9 10 ...
## $ Año : int 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 ...
## $ Territorio : chr "Guadalajara" "Guadalajara" "Guadalajara" "Guadalajara" ...
## $ Sub.Territorio : chr "Belenes" "Belenes" "Belenes" "Belenes" ...
## $ CEDI : chr "Suc. Belenes" "Suc. Belenes" "Suc. Belenes" "Suc. Belenes" ...
## $ Cliente : chr "77737" "77737" "77737" "77737" ...
## $ Nombre : chr "ABARR" "ABARR" "ABARR" "ABARR" ...
## $ Tamaño.Cte.Industria: chr "Extra Grande" "Extra Grande" "Extra Grande" "Extra Grande" ...
## $ Segmento.Det : chr "Agua Mineral" "Agua Purificada" "Agua Purificada" "Agua Saborizada" ...
## $ Marca : chr "Topo Chico A.M." "Ciel Agua Purificada" "Ciel Agua Purificada" "Ciel Exprim" ...
## $ Presentacion : chr "600 ml NR" "1 Ltro. N.R." "1.5 Lts. NR" "600 ml NR" ...
## $ Tamaño : chr "Individual" "Individual" "Individual" "Individual" ...
## $ Retornable_NR : chr "No Retornable" "No Retornable" "No Retornable" "No Retornable" ...
## $ Enero : chr "" "" "" "" ...
## $ Febrero : chr "" "2" "" "" ...
## $ Marzo : chr "" "8" "3" "" ...
## $ Abril : chr "" "4" "6" "" ...
## $ Mayo : chr "" "4" "3" "" ...
## $ Junio : chr "" "2" "3" "" ...
## $ Julio : chr "" "2" "3" "" ...
## $ Agosto : chr "" "2" "3" "" ...
## $ Septiembre : chr "" "2" "3" "" ...
## $ Octubre : chr "" "2" "3" "" ...
## $ Noviembre : chr "" "4" "3" "" ...
## $ Diciembre : chr "1" "2" "3" "1" ...
Después de analizar la tabla de datos: 1. Las columnas de meses (Enero - Diciembre) tienen formato incorrecto. Debería estar en int (entero) 2. Quitar el renglón repetido 184065 que cuenta los subtítulos
#Limpieza de datos
##Eliminar renglón
##Cambiar variables
#Hacer un ciclo For para no tener que copiar y pegar cada variable para cambiarla.
for (mes in c("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre")) {
df[[mes]] <- as.integer(df[[mes]])
}## Warning: NAs introduced by coercion
## Warning: NAs introduced by coercion
## Warning: NAs introduced by coercion
## Warning: NAs introduced by coercion
## Warning: NAs introduced by coercion
## Warning: NAs introduced by coercion
## Warning: NAs introduced by coercion
## Warning: NAs introduced by coercion
## Warning: NAs introduced by coercion
## Warning: NAs introduced by coercion
## Warning: NAs introduced by coercion
## Warning: NAs introduced by coercion
## [1] 3149791
## ID Año Territorio
## 0 0 0
## Sub.Territorio CEDI Cliente
## 0 0 0
## Nombre Tamaño.Cte.Industria Segmento.Det
## 0 0 0
## Marca Presentacion Tamaño
## 0 0 0
## Retornable_NR Enero Febrero
## 0 233551 231285
## Marzo Abril Mayo
## 227506 224185 217072
## Junio Julio Agosto
## 215907 223537 220366
## Septiembre Octubre Noviembre
## 337401 338482 338545
## Diciembre
## 341954
df$Ventas <- df$Enero + df$Febrero + df$Marzo + df$Abril + df$Mayo + df$Junio + df$Julio + df$Agosto + df$Septiembre + df$Octubre + df$Noviembre + df$Diciembre
#Gráfica de caja y bigotes
boxplot(df$Enero, horizontal=TRUE)## ID Año Territorio Sub.Territorio
## Min. : 1 Length:466508 Length:466508 Length:466508
## 1st Qu.:116628 Class :character Class :character Class :character
## Median :233256 Mode :character Mode :character Mode :character
## Mean :233255
## 3rd Qu.:349882
## Max. :466509
## CEDI Cliente Nombre Tamaño.Cte.Industria
## Length:466508 Length:466508 Length:466508 Length:466508
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## Segmento.Det Marca Presentacion Tamaño
## Length:466508 Length:466508 Length:466508 Length:466508
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## Retornable_NR Enero Febrero Marzo
## Length:466508 Min. :-19.00 Min. :-11.000 Min. :-32.000
## Class :character 1st Qu.: 0.00 1st Qu.: 0.000 1st Qu.: 0.000
## Mode :character Median : 0.00 Median : 0.000 Median : 0.000
## Mean : 4.69 Mean : 4.581 Mean : 5.401
## 3rd Qu.: 2.00 3rd Qu.: 2.000 3rd Qu.: 3.000
## Max. :999.00 Max. :986.000 Max. :986.000
## Abril Mayo Junio Julio
## Min. :-70.000 Min. :-106.000 Min. :-211.0 Min. :-60.000
## 1st Qu.: 0.000 1st Qu.: 0.000 1st Qu.: 0.0 1st Qu.: 0.000
## Median : 0.000 Median : 0.000 Median : 0.0 Median : 0.000
## Mean : 5.519 Mean : 6.117 Mean : 5.9 Mean : 5.583
## 3rd Qu.: 3.000 3rd Qu.: 3.000 3rd Qu.: 3.0 3rd Qu.: 3.000
## Max. :993.000 Max. : 991.000 Max. : 998.0 Max. :993.000
## Agosto Septiembre Octubre Noviembre
## Min. :-211.000 Min. :-527.000 Min. :-38.000 Min. :-25.000
## 1st Qu.: 0.000 1st Qu.: 0.000 1st Qu.: 0.000 1st Qu.: 0.000
## Median : 0.000 Median : 0.000 Median : 0.000 Median : 0.000
## Mean : 5.777 Mean : 3.311 Mean : 3.327 Mean : 3.248
## 3rd Qu.: 3.000 3rd Qu.: 1.000 3rd Qu.: 1.000 3rd Qu.: 1.000
## Max. : 999.000 Max. : 993.000 Max. :998.000 Max. :991.000
## Diciembre Ventas
## Min. :-28.000 Min. :-527.00
## 1st Qu.: 0.000 1st Qu.: 2.00
## Median : 0.000 Median : 7.00
## Mean : 3.477 Mean : 56.93
## 3rd Qu.: 0.000 3rd Qu.: 26.00
## Max. :997.000 Max. :9517.00
¿Puede observarse un crecimiento en las ventas de algunos de los segmentos de productos de la familia Coca Cola en las tiendas en las que se implementó el Proyecto Siglo XXI de Arca Continental? Respuesta: Se observa un incremento general de las ventas por año
library(ggplot2)
ggplot(df, aes(x=Año, y=Ventas)) +
geom_bar(stat="identity") +
labs(
title= "Ventas por año",
subtitle= "Caso Arca Continental"
)## [1] 55
¿El incremento en las ventas es similar entre los diferentes tamaños de clientes? Respuesta: El incremento de ventas se debió a la incorporación de tamaño de cliente Grande y Pequeño, Extra Grande bajó sus ventas el último año, y Micro las subió.
ggplot(df, aes(x=Año, y=Ventas, colour=Tamaño.Cte.Industria)) +
geom_bar(stat = "identity") +
labs(
title= "Ventas por año",
subtitle = "Caso Arca Continental"
)df2 <- df %>% filter(Tamaño.Cte.Industria=="Extra Grande")
ggplot(df2, aes(x=Año, y=Ventas, colour= Tamaño.Cte.Industria)) +
geom_bar(stat = "identity") +
labs(
title= "Ventas por año",
subtitle = "Caso Arca Continental"
)df3 <- df %>% filter(Tamaño.Cte.Industria=="Grande")
ggplot(df3, aes(x=Año, y=Ventas, colour= Tamaño.Cte.Industria)) +
geom_bar(stat = "identity") +
labs(
title= "Ventas por año",
subtitle = "Caso Arca Continental"
)df4 <- df %>% filter(Tamaño.Cte.Industria=="Micro")
ggplot(df4, aes(x=Año, y=Ventas, colour= Tamaño.Cte.Industria)) +
geom_bar(stat = "identity") +
labs(
title= "Ventas por año",
subtitle = "Caso Arca Continental"
)df5 <- df %>% filter(Tamaño.Cte.Industria=="Pequeño")
ggplot(df5, aes(x=Año, y=Ventas, colour= Tamaño.Cte.Industria)) +
geom_bar(stat = "identity") +
labs(
title= "Ventas por año",
subtitle = "Caso Arca Continental"
)¿Cuál es el comportamiento observado de las unidades vendidas por mes de cada una de las marcas, independientemente de sus respectivas presentaciones? Respuesta: El incremento de ventas se debió a la incorporación de tamaño de cliente Grande Y Pequeño.
df6 <- df %>% filter(Marca== "Coca-Cola")
ggplot(df6, aes(x=Año, y=Ventas, colour=Tamaño.Cte.Industria))+
geom_bar(stat="identity")+
labs(
title= "Ventas por Año de Coca Cola",
subtitle = "Caso Arca Continental"
)df6 <- df %>% filter(Marca== "Sprite")
ggplot(df6, aes(x=Año, y=Ventas, colour=Tamaño.Cte.Industria))+
geom_bar(stat="identity")+
labs(
title= "Ventas por Año de Sprite",
subtitle = "Caso Arca Continental"
)¿Se ha incrementado la venta de productos en envases retornables en los últimos dos años? Respuesta: El valor de compras de envases retornables se dúplico en el úitimo año
#Hay que corregir esto, contaste cuantas veces aparece la palabra retornable, no sus ventas. Update: Ya lo corregí.
Retornable <- df %>% filter(df$Retornable_NR == "Retornable")
ggplot(Retornable, aes(x=Año, y=Ventas)) +
geom_bar(stat = "identity", fill="red") +
labs(
title= "Compras de envases retornables por año",
subtitle = "Caso Arca Continental"
)¿El comportamiento de la venta de agua ha incrementado en relación al de los refrescos o las bebidas isotónicas?
Respuesta: El consumo de refrescos se ha mantenido regular durante los años, en 2018 aumentó un porcentaje de sus ventas y el comportamiento fue seguido por las ventas de aguas. Sin emabrgo en 2019 las ventas tuvieron un retroceso, mientras que las isotónicas aumentaron.
#Que esta pasando aquí? Por qué las líneas me salen rectas? Tendré que hacer un cálculo manual?
dfagua <- df %>% filter(Segmento.Det %in% c("Agua Purificada", "Isotónicos Regular", "Colas Regular"))
ggplot(dfagua,aes(x=Año,y=Ventas,fill=Segmento.Det)) +
geom_bar(position="dodge", stat="identity")+
labs(
title= "Ventas por año",
subtitle = "Caso Arca Continental"
)¿Puede decirse que la venta mensual de agua está relacionada con la venta mensual de refrescos en los últimos 4 años?
Respuesta: La venta de agua y refresco no esta relacionada
dfcocas <- df %>% filter(Segmento.Det %in% c("Agua Purificada", "Colas Regular"))
ggplot(dfcocas,aes(x=Año,y=Ventas,fill=Segmento.Det)) +
geom_bar(position="dodge", stat="identity")+
labs(
title= "Ventas por año",
subtitle = "Caso Arca Continental"
)¿A cuánto ascienden las ventas esperadas para el 2020 en la Coca Cola de 500 ml NR Vidrio? Respuesta: Las ventas ascienden hasta $444,065, por lo que podemos concluir que la propuesta de arca va por muy buen camino
df11 <- df %>% filter(Marca=="Coca-Cola" & Presentacion=="500 ml NR Vidrio")
df12 <- aggregate(Ventas ~ Año, df11, sum)
df12$Año <- as.integer(df12$Año)
regresion <-lm(Ventas ~ Año, data=df12)
summary(regresion)##
## Call:
## lm(formula = Ventas ~ Año, data = df12)
##
## Residuals:
## 1 2 3 4
## -23838.5 35316.5 882.5 -12360.5
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -54970594 28310425 -1.942 0.192
## Año 27433 14032 1.955 0.190
##
## Residual standard error: 31380 on 2 degrees of freedom
## Multiple R-squared: 0.6565, Adjusted R-squared: 0.4847
## F-statistic: 3.822 on 1 and 2 DF, p-value: 0.1898
#Ecuación de la recta y=-54,970,595 + 27,433*Año
datos <- data.frame(Año=2020)
predict(regresion,datos)## 1
## 444065.5