Contexto

Para Arca Continental es vital que las tienditas de la esquina sigan existiendo ya que los mayores márgenes de ganancia en la venta de sus productos los obtiene a través de este canal.

Instalar paquetes y llamar librerías

# install.packages("tidyverse")
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.1
## ✔ purrr     1.0.4     
## ── 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
# install.packages("dplyr")
library(dplyr)
# install.packages("lubridate")
library(lubridate)
# install.packages("plyr")
 library(plyr) 
## ------------------------------------------------------------------------------
## You have loaded plyr after dplyr - this is likely to cause problems.
## If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
## library(plyr); library(dplyr)
## ------------------------------------------------------------------------------
## 
## Adjuntando el paquete: 'plyr'
## 
## The following objects are masked from 'package:dplyr':
## 
##     arrange, count, desc, failwith, id, mutate, rename, summarise,
##     summarize
## 
## The following object is masked from 'package:purrr':
## 
##     compact
# install.packages("readxl")
 library(readxl)
# install.packages("ggplot2")
library(ggplot2)
# install.packages("forecast")
library(forecast) 
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo

Importar la base de datos

 # file.choose()
 df <- read_excel("C:\\Users\\52967\\Downloads\\Datos Arca Continental Original.xlsx")
## Warning: Expecting numeric in N184066 / R184066C14: got a date
## Warning: Expecting numeric in O184066 / R184066C15: got a date
## Warning: Expecting numeric in P184066 / R184066C16: got a date
## Warning: Expecting numeric in Q184066 / R184066C17: got a date
## Warning: Expecting numeric in R184066 / R184066C18: got a date
## Warning: Expecting numeric in S184066 / R184066C19: got a date
## Warning: Expecting numeric in T184066 / R184066C20: got a date
## Warning: Expecting numeric in U184066 / R184066C21: got a date
## Warning: Expecting numeric in V184066 / R184066C22: got a date
## Warning: Expecting numeric in W184066 / R184066C23: got a date
## Warning: Expecting numeric in X184066 / R184066C24: got a date
## Warning: Expecting numeric in Y184066 / R184066C25: got a date

Entender la base de datos

summary(df)
##        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      Min.   :  -19.0   Min.   :  -11.00   Min.   :  -32.00  
##  Class :character   1st Qu.:    1.0   1st Qu.:    1.00   1st Qu.:    1.00  
##  Mode  :character   Median :    2.0   Median :    2.00   Median :    3.00  
##                     Mean   :   10.1   Mean   :    9.76   Mean   :   11.36  
##                     3rd Qu.:    6.0   3rd Qu.:    6.00   3rd Qu.:    6.00  
##                     Max.   :42736.0   Max.   :42767.00   Max.   :42795.00  
##                     NA's   :233480    NA's   :231213     NA's   :227420    
##      Abril               Mayo              Junio             Julio         
##  Min.   :  -70.00   Min.   : -106.00   Min.   : -211.0   Min.   :  -60.00  
##  1st Qu.:    1.00   1st Qu.:    1.00   1st Qu.:    1.0   1st Qu.:    1.00  
##  Median :    3.00   Median :    3.00   Median :    3.0   Median :    2.00  
##  Mean   :   11.71   Mean   :   12.75   Mean   :   12.2   Mean   :   11.75  
##  3rd Qu.:    6.00   3rd Qu.:    7.00   3rd Qu.:    6.0   3rd Qu.:    6.00  
##  Max.   :42826.00   Max.   :42856.00   Max.   :42887.0   Max.   :42917.00  
##  NA's   :224057     NA's   :216910     NA's   :215753    NA's   :223411    
##      Agosto           Septiembre         Octubre          Noviembre      
##  Min.   : -211.00   Min.   : -527.0   Min.   :  -38.0   Min.   :  -25.0  
##  1st Qu.:    1.00   1st Qu.:    1.0   1st Qu.:    1.0   1st Qu.:    1.0  
##  Median :    3.00   Median :    3.0   Median :    3.0   Median :    3.0  
##  Mean   :   11.98   Mean   :   13.4   Mean   :   13.7   Mean   :   13.3  
##  3rd Qu.:    6.00   3rd Qu.:    7.0   3rd Qu.:    7.0   3rd Qu.:    6.0  
##  Max.   :42948.00   Max.   :42979.0   Max.   :43009.0   Max.   :43040.0  
##  NA's   :220242     NA's   :337314    NA's   :338386    NA's   :338460   
##    Diciembre      
##  Min.   :  -28.0  
##  1st Qu.:    1.0  
##  Median :    3.0  
##  Mean   :   14.8  
##  3rd Qu.:    7.0  
##  Max.   :43070.0  
##  NA's   :341855
str(df)
## tibble [466,509 × 25] (S3: tbl_df/tbl/data.frame)
##  $ ID                  : num [1:466509] 1 2 3 4 5 6 7 8 9 10 ...
##  $ Año                 : num [1:466509] 2016 2016 2016 2016 2016 ...
##  $ Territorio          : chr [1:466509] "Guadalajara" "Guadalajara" "Guadalajara" "Guadalajara" ...
##  $ Sub Territorio      : chr [1:466509] "Belenes" "Belenes" "Belenes" "Belenes" ...
##  $ CEDI                : chr [1:466509] "Suc. Belenes" "Suc. Belenes" "Suc. Belenes" "Suc. Belenes" ...
##  $ Cliente             : chr [1:466509] "77737" "77737" "77737" "77737" ...
##  $ Nombre              : chr [1:466509] "ABARR" "ABARR" "ABARR" "ABARR" ...
##  $ Tamaño Cte Industria: chr [1:466509] "Extra Grande" "Extra Grande" "Extra Grande" "Extra Grande" ...
##  $ Segmento Det        : chr [1:466509] "Agua Mineral" "Agua Purificada" "Agua Purificada" "Agua Saborizada" ...
##  $ Marca               : chr [1:466509] "Topo Chico A.M." "Ciel Agua Purificada" "Ciel Agua Purificada" "Ciel Exprim" ...
##  $ Presentacion        : chr [1:466509] "600 ml NR" "1 Ltro. N.R." "1.5 Lts. NR" "600 ml NR" ...
##  $ Tamaño              : chr [1:466509] "Individual" "Individual" "Individual" "Individual" ...
##  $ Retornable_NR       : chr [1:466509] "No Retornable" "No Retornable" "No Retornable" "No Retornable" ...
##  $ Enero               : num [1:466509] NA NA NA NA NA NA 1 NA 3 NA ...
##  $ Febrero             : num [1:466509] NA 2 NA NA NA NA NA 1 3 NA ...
##  $ Marzo               : num [1:466509] NA 8 3 NA NA 1 NA NA 4 NA ...
##  $ Abril               : num [1:466509] NA 4 6 NA NA NA NA 1 4 NA ...
##  $ Mayo                : num [1:466509] NA 4 3 NA NA NA 0 NA 4 NA ...
##  $ Junio               : num [1:466509] NA 2 3 NA NA NA NA 1 4 0 ...
##  $ Julio               : num [1:466509] NA 2 3 NA NA NA 0 NA 4 NA ...
##  $ Agosto              : num [1:466509] NA 2 3 NA NA NA NA 1 7 NA ...
##  $ Septiembre          : num [1:466509] NA 2 3 NA NA NA NA 1 4 NA ...
##  $ Octubre             : num [1:466509] NA 2 3 NA NA NA 0 NA 3 NA ...
##  $ Noviembre           : num [1:466509] NA 4 3 NA 0 NA NA NA 1 NA ...
##  $ Diciembre           : num [1:466509] 1 2 3 1 NA NA NA NA 3 NA ...
head(df)
## # A tibble: 6 × 25
##      ID   Año Territorio  `Sub Territorio` CEDI         Cliente Nombre
##   <dbl> <dbl> <chr>       <chr>            <chr>        <chr>   <chr> 
## 1     1  2016 Guadalajara Belenes          Suc. Belenes 77737   ABARR 
## 2     2  2016 Guadalajara Belenes          Suc. Belenes 77737   ABARR 
## 3     3  2016 Guadalajara Belenes          Suc. Belenes 77737   ABARR 
## 4     4  2016 Guadalajara Belenes          Suc. Belenes 77737   ABARR 
## 5     5  2016 Guadalajara Belenes          Suc. Belenes 77737   ABARR 
## 6     6  2016 Guadalajara Belenes          Suc. Belenes 77737   ABARR 
## # ℹ 18 more variables: `Tamaño Cte Industria` <chr>, `Segmento Det` <chr>,
## #   Marca <chr>, Presentacion <chr>, Tamaño <chr>, Retornable_NR <chr>,
## #   Enero <dbl>, Febrero <dbl>, Marzo <dbl>, Abril <dbl>, Mayo <dbl>,
## #   Junio <dbl>, Julio <dbl>, Agosto <dbl>, Septiembre <dbl>, Octubre <dbl>,
## #   Noviembre <dbl>, Diciembre <dbl>
tail(df, n=10)
## # A tibble: 10 × 25
##        ID   Año Territorio  `Sub Territorio` CEDI           Cliente Nombre
##     <dbl> <dbl> <chr>       <chr>            <chr>          <chr>   <chr> 
##  1 466500  2019 Guadalajara Huentitán        Suc. Huentitán 4531    HECTO 
##  2 466501  2019 Guadalajara Huentitán        Suc. Huentitán 4531    HECTO 
##  3 466502  2019 Guadalajara Huentitán        Suc. Huentitán 4531    HECTO 
##  4 466503  2019 Guadalajara Huentitán        Suc. Huentitán 4531    HECTO 
##  5 466504  2019 Guadalajara Huentitán        Suc. Huentitán 4531    HECTO 
##  6 466505  2019 Guadalajara Huentitán        Suc. Huentitán 4531    HECTO 
##  7 466506  2019 Guadalajara Huentitán        Suc. Huentitán 4531    HECTO 
##  8 466507  2019 Guadalajara Huentitán        Suc. Huentitán 4531    HECTO 
##  9 466508  2019 Guadalajara Huentitán        Suc. Huentitán 4531    HECTO 
## 10 466509  2019 Guadalajara Huentitán        Suc. Huentitán 4531    HECTO 
## # ℹ 18 more variables: `Tamaño Cte Industria` <chr>, `Segmento Det` <chr>,
## #   Marca <chr>, Presentacion <chr>, Tamaño <chr>, Retornable_NR <chr>,
## #   Enero <dbl>, Febrero <dbl>, Marzo <dbl>, Abril <dbl>, Mayo <dbl>,
## #   Junio <dbl>, Julio <dbl>, Agosto <dbl>, Septiembre <dbl>, Octubre <dbl>,
## #   Noviembre <dbl>, Diciembre <dbl>
colnames(df) <- gsub(" ", "_", colnames(df))
 # dplyr::count(bd, Territorio, sort=TRUE)
 # dplyr::count(bd, Sub_Territorio, sort=TRUE)
 # dplyr::count(bd, CEDI, sort=TRUE)
 # dplyr::count(bd, Cliente, sort=TRUE)
 # dplyr::count(bd, Nombre, sort=TRUE)
 # dplyr::count(bd, Tamaño_Cte_Industria, sort=TRUE)
 # dplyr::count(bd, Segmento Det, sort=TRUE)
 # dplyr::count(bd, Marca, sort=TRUE)
 # dplyr::count(bd, Presentacion, sort=TRUE)
 # dplyr::count(bd, Tamaño, sort=TRUE)
 # dplyr::count(bd, Retornable_NR, sort=TRUE)

df$Enero <- as.integer.

Limpiar la base de datos

##Técnica 1. Remover valores irrelevantes

df1 <- df
df1 <- df1 [-184065, ] # Era un renglón con los totales de la tabla
summary(df1)
##        ID              Año        Territorio        Sub_Territorio    
##  Min.   :     1   Min.   :2016   Length:466508      Length:466508     
##  1st Qu.:116628   1st Qu.:2017   Class :character   Class :character  
##  Median :233256   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: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.00   Min.   : -32.00  
##  Class :character   1st Qu.:   1.00   1st Qu.:   1.00   1st Qu.:   1.00  
##  Mode  :character   Median :   2.00   Median :   2.00   Median :   3.00  
##                     Mean   :   9.91   Mean   :   9.57   Mean   :  11.18  
##                     3rd Qu.:   6.00   3rd Qu.:   6.00   3rd Qu.:   6.00  
##                     Max.   :5333.00   Max.   :4995.00   Max.   :5636.00  
##                     NA's   :233480    NA's   :231213    NA's   :227420   
##      Abril              Mayo             Junio             Julio        
##  Min.   : -70.00   Min.   :-106.00   Min.   :-211.00   Min.   : -60.00  
##  1st Qu.:   1.00   1st Qu.:   1.00   1st Qu.:   1.00   1st Qu.:   1.00  
##  Median :   3.00   Median :   3.00   Median :   3.00   Median :   2.00  
##  Mean   :  11.53   Mean   :  12.58   Mean   :  12.03   Mean   :  11.58  
##  3rd Qu.:   6.00   3rd Qu.:   7.00   3rd Qu.:   6.00   3rd Qu.:   6.00  
##  Max.   :6164.00   Max.   :6759.00   Max.   :6033.00   Max.   :6735.00  
##  NA's   :224057    NA's   :216910    NA's   :215753    NA's   :223411   
##      Agosto          Septiembre        Octubre         Noviembre     
##  Min.   :-211.00   Min.   :-527.0   Min.   : -38.0   Min.   : -25    
##  1st Qu.:   1.00   1st Qu.:   1.0   1st Qu.:   1.0   1st Qu.:   1    
##  Median :   3.00   Median :   3.0   Median :   3.0   Median :   3    
##  Mean   :  11.81   Mean   :  13.1   Mean   :  13.4   Mean   :  13    
##  3rd Qu.:   6.00   3rd Qu.:   7.0   3rd Qu.:   7.0   3rd Qu.:   6    
##  Max.   :6065.00   Max.   :6509.0   Max.   :6326.0   Max.   :5319    
##  NA's   :220242    NA's   :337314   NA's   :338386   NA's   :338460  
##    Diciembre     
##  Min.   : -28.0  
##  1st Qu.:   1.0  
##  Median :   3.0  
##  Mean   :  14.4  
##  3rd Qu.:   7.0  
##  Max.   :6182.0  
##  NA's   :341855

Técnica 2. Remover valores duplicados

 # ¿Cuántos renglones duplicados tenemos?
 sum(duplicated(df1))
## [1] 0
 # ¿Cuáles son los renglones duplicados tenemos?
 df[duplicated(df),]
## # A tibble: 0 × 25
## # ℹ 25 variables: ID <dbl>, Año <dbl>, Territorio <chr>, Sub_Territorio <chr>,
## #   CEDI <chr>, Cliente <chr>, Nombre <chr>, Tamaño_Cte_Industria <chr>,
## #   Segmento_Det <chr>, Marca <chr>, Presentacion <chr>, Tamaño <chr>,
## #   Retornable_NR <chr>, Enero <dbl>, Febrero <dbl>, Marzo <dbl>, Abril <dbl>,
## #   Mayo <dbl>, Junio <dbl>, Julio <dbl>, Agosto <dbl>, Septiembre <dbl>,
## #   Octubre <dbl>, Noviembre <dbl>, Diciembre <dbl>

Técnica 3. Eliminar errores tipográficos y similares

# Cantidades en enteros
 df2 <- df1
df2$Enero <- abs(df2$Enero)
df2$Enero <- abs(df2$Febrero)
df2$Enero <- abs(df2$Marzo)
df2$Enero <- abs(df2$Abril)
df2$Enero <- abs(df2$Mayo)
df2$Enero <- abs(df2$Junio)
df2$Enero <- abs(df2$Julio)
df2$Enero <- abs(df2$Agosto)
df2$Enero <- abs(df2$Septiembre)
df2$Enero <- abs(df2$Octubre)
df2$Enero <- abs(df2$Noviembre)
df2$Enero <- abs(df2$Diciembre)
summary(df2)
##        ID              Año        Territorio        Sub_Territorio    
##  Min.   :     1   Min.   :2016   Length:466508      Length:466508     
##  1st Qu.:116628   1st Qu.:2017   Class :character   Class :character  
##  Median :233256   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: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.   :   0.0   Min.   : -11.00   Min.   : -32.00  
##  Class :character   1st Qu.:   1.0   1st Qu.:   1.00   1st Qu.:   1.00  
##  Mode  :character   Median :   3.0   Median :   2.00   Median :   3.00  
##                     Mean   :  14.5   Mean   :   9.57   Mean   :  11.18  
##                     3rd Qu.:   7.0   3rd Qu.:   6.00   3rd Qu.:   6.00  
##                     Max.   :6182.0   Max.   :4995.00   Max.   :5636.00  
##                     NA's   :341855   NA's   :231213    NA's   :227420   
##      Abril              Mayo             Junio             Julio        
##  Min.   : -70.00   Min.   :-106.00   Min.   :-211.00   Min.   : -60.00  
##  1st Qu.:   1.00   1st Qu.:   1.00   1st Qu.:   1.00   1st Qu.:   1.00  
##  Median :   3.00   Median :   3.00   Median :   3.00   Median :   2.00  
##  Mean   :  11.53   Mean   :  12.58   Mean   :  12.03   Mean   :  11.58  
##  3rd Qu.:   6.00   3rd Qu.:   7.00   3rd Qu.:   6.00   3rd Qu.:   6.00  
##  Max.   :6164.00   Max.   :6759.00   Max.   :6033.00   Max.   :6735.00  
##  NA's   :224057    NA's   :216910    NA's   :215753    NA's   :223411   
##      Agosto          Septiembre        Octubre         Noviembre     
##  Min.   :-211.00   Min.   :-527.0   Min.   : -38.0   Min.   : -25    
##  1st Qu.:   1.00   1st Qu.:   1.0   1st Qu.:   1.0   1st Qu.:   1    
##  Median :   3.00   Median :   3.0   Median :   3.0   Median :   3    
##  Mean   :  11.81   Mean   :  13.1   Mean   :  13.4   Mean   :  13    
##  3rd Qu.:   6.00   3rd Qu.:   7.0   3rd Qu.:   7.0   3rd Qu.:   6    
##  Max.   :6065.00   Max.   :6509.0   Max.   :6326.0   Max.   :5319    
##  NA's   :220242    NA's   :337314   NA's   :338386   NA's   :338460  
##    Diciembre     
##  Min.   : -28.0  
##  1st Qu.:   1.0  
##  Median :   3.0  
##  Mean   :  14.4  
##  3rd Qu.:   7.0  
##  Max.   :6182.0  
##  NA's   :341855

Técnica 4. Convertir tipos de datos

No Aplica

Técnica 5. Reemplazar valores faltantes

# ¿Cuántos NAs tengo en la base de datos?
sum(is.na(df2))
## [1] 3256876
 # ¿Cuántos NAs tengo por variable?
sapply(df2, function(x) sum(is.na(x)))
##                   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               341855               231213 
##                Marzo                Abril                 Mayo 
##               227420               224057               216910 
##                Junio                Julio               Agosto 
##               215753               223411               220242 
##           Septiembre              Octubre            Noviembre 
##               337314               338386               338460 
##            Diciembre 
##               341855
# Reemplazar los NAs con CEROS
df3 <-df2
df3[is.na(df3)] <-0

Técnica 6. Correcciones por métodos estadísticos

boxplot(df3$Enero, horizontal=TRUE)

boxplot(df3$Febrero, horizontal=TRUE)

# Agregar columnas No aplica

LS0tDQp0aXRsZTogIkFyY2EgQ29udGluZW50YWwiDQphdXRob3I6ICJBYmlnYWlsIE1vcmEiDQpkYXRlOiAiMjAyNS0wMy0yMCINCm91dHB1dDogDQogIGh0bWxfZG9jdW1lbnQ6DQogICAgdG9jOiBUUlVFDQogICAgdG9jX2Zsb2F0OiBUUlVFDQogICAgY29kZV9kb3dubG9hZDogVFJVRQ0KICAgIHRoZW1lOiAibHVtZW4iDQotLS0NCg0KIVtdKGh0dHBzOi8vaS5waW5pbWcuY29tL29yaWdpbmFscy83ZC8yNi84ZS83ZDI2OGVjZWJiMjU2ODZhMmVkMzhmODdkMTIyYWUxOS5naWYpDQoNCiMgQ29udGV4dG8gDQpQYXJhICoqQXJjYSBDb250aW5lbnRhbCoqIGVzIHZpdGFsIHF1ZSBsYXMgdGllbmRpdGFzIGRlIGxhIGVzcXVpbmEgc2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