## Descargar librerías
library(foreign)
library(dplyr) # data manipulation
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(forcats) # to work with categorical variables
library(ggplot2) # data visualization
library(readr) # read specific csv files
library(janitor) # data exploration and cleaning
##
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test
library(Hmisc) # several useful functions for data analysis
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
##
## Attaching package: 'Hmisc'
## The following objects are masked from 'package:dplyr':
##
## src, summarize
## The following objects are masked from 'package:base':
##
## format.pval, units
library(psych) # functions for multivariate analysis
##
## Attaching package: 'psych'
## The following object is masked from 'package:Hmisc':
##
## describe
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
library(naniar) # summaries and visualization of missing values NAs
library(dlookr) # summaries and visualization of missing values NAs
##
## Attaching package: 'dlookr'
## The following object is masked from 'package:psych':
##
## describe
## The following object is masked from 'package:Hmisc':
##
## describe
## The following object is masked from 'package:base':
##
## transform
library(corrplot) # correlation plots
## corrplot 0.92 loaded
library(jtools) # presentation of regression analysis
##
## Attaching package: 'jtools'
## The following object is masked from 'package:Hmisc':
##
## %nin%
library(lmtest) # diagnostic checks - linear regression analysis
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
library(car) # diagnostic checks - linear regression analysis
## Loading required package: carData
##
## Attaching package: 'car'
## The following object is masked from 'package:psych':
##
## logit
## The following object is masked from 'package:dplyr':
##
## recode
library(olsrr) # diagnostic checks - linear regression analysis
##
## Attaching package: 'olsrr'
## The following object is masked from 'package:datasets':
##
## rivers
library(kableExtra) # HTML table attributes
##
## Attaching package: 'kableExtra'
## The following object is masked from 'package:dplyr':
##
## group_rows
library(gmodels)
library(openxlsx)
library(crosstable)
### Importar base de datos
df1 <-read.csv(file.choose())
summary(df1)
## No. CLIENTE ID.FORM PRODUCTO
## Min. : 1.0 Length:1946 Length:1946 Length:1946
## 1st Qu.: 487.2 Class :character Class :character Class :character
## Median : 973.5 Mode :character Mode :character Mode :character
## Mean : 973.5
## 3rd Qu.:1459.8
## Max. :1946.0
##
## X PIEZAS.PROG. TMO..MIN. HR..FIN
## Length:1946 Length:1946 Length:1946 Length:1946
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## ESTACION.ARRANQUE Laminas.procesadas INICIO.SEP.UP FIN.INICIO.DE.SEP.UP
## Length:1946 Length:1946 Length:1946 Length:1946
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## INICIO.de.PROCESO FIN.de.PROCESO TIEMPO.CALIDAD TIEMPO.MATERIALES
## Length:1946 Length:1946 Min. : 0.000 Length:1946
## Class :character Class :character 1st Qu.: 0.000 Class :character
## Mode :character Mode :character Median : 0.000 Mode :character
## Mean : 1.639
## 3rd Qu.: 1.000
## Max. :36.000
## NA's :1644
## Fecha Status
## Length:1946 Length:1946
## Class :character Class :character
## Mode :character Mode :character
##
##
##
##
describe(df1)
## # A tibble: 2 × 26
## describe…¹ n na mean sd se_mean IQR skewn…² kurto…³ p00 p01
## <chr> <int> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 No. 1946 0 974. 562. 12.7 972. 0 -1.2 1 20.4
## 2 TIEMPO.CA… 302 1644 1.64 4.51 0.260 1 4.73 27.0 0 0
## # … with 15 more variables: p05 <dbl>, p10 <dbl>, p20 <dbl>, p25 <dbl>,
## # p30 <dbl>, p40 <dbl>, p50 <dbl>, p60 <dbl>, p70 <dbl>, p75 <dbl>,
## # p80 <dbl>, p90 <dbl>, p95 <dbl>, p99 <dbl>, p100 <dbl>, and abbreviated
## # variable names ¹described_variables, ²skewness, ³kurtosis
variable<-c("No.", "CLIENTE","ID.FORM","PRODUCTO","PIEZAS.PROG.","TMO..MIN.","HR..FIN","ESTACION.ARRANQUE","Laminas.procesadas","INICIO.SEP.UP","FIN.INICIO.DE.SEP.UP","INICIO.de.PROCESO","FIN.de.PROCESO","TIEMPO.CALIDAD","TIEMPO.MATERIALES","Fecha","Status")
Type<-c("quantitative (continous)", "qualitative (discrete)","qualitative (discrete)","qualitative (discrete)","quantitative (continous)","quantitative (continous)","quantitative (continous)","qualitative (discrete)","quantitative (continous)","quantitative (continous)","quantitative (continous)","quantitative (continous)","quantitative (continous)","quantitative (continous)","quantitative (continous)","quantitative (continous)","qualitative (discrete)")
table<-data.frame(variable,Type)
knitr::kable(table)
| variable | Type |
|---|---|
| No. | quantitative (continous) |
| CLIENTE | qualitative (discrete) |
| ID.FORM | qualitative (discrete) |
| PRODUCTO | qualitative (discrete) |
| PIEZAS.PROG. | quantitative (continous) |
| TMO..MIN. | quantitative (continous) |
| HR..FIN | quantitative (continous) |
| ESTACION.ARRANQUE | qualitative (discrete) |
| Laminas.procesadas | quantitative (continous) |
| INICIO.SEP.UP | quantitative (continous) |
| FIN.INICIO.DE.SEP.UP | quantitative (continous) |
| INICIO.de.PROCESO | quantitative (continous) |
| FIN.de.PROCESO | quantitative (continous) |
| TIEMPO.CALIDAD | quantitative (continous) |
| TIEMPO.MATERIALES | quantitative (continous) |
| Fecha | quantitative (continous) |
| Status | qualitative (discrete) |
variables <- c("No.", "CLIENTE","ID.FORM","PRODUCTO","PIEZAS.PROG.","TMO..MIN.","HR..FIN","ESTACION.ARRANQUE","Laminas.procesadas","INICIO.SEP.UP","FIN.INICIO.DE.SEP.UP","INICIO.de.PROCESO","FIN.de.PROCESO","TIEMPO.CALIDAD","TIEMPO.MATERIALES","Fecha","Status")
tipos <- c("cuantitativo", "cualitativo", "cualitativo","cualitativo","cuantitativo","cuantitativo","cuantitativo","cualitativo","cuantitativo","cuantitativo","cuantitativo","cuantitativo","cuantitativo","cuantitativo","cuantitativo","cuantitativo","cualitativo")
escalas <- c("Razón","Nominal","Nominal","Nominal","Razón","Razón","Razón","Nominal","Razón","Razón","Razón","Razón","Razón","Razón","Razón","Razón","Ordinal")
table1 <- data.frame (variables, tipos, escalas)
knitr::kable(table1)
| variables | tipos | escalas |
|---|---|---|
| No. | cuantitativo | Razón |
| CLIENTE | cualitativo | Nominal |
| ID.FORM | cualitativo | Nominal |
| PRODUCTO | cualitativo | Nominal |
| PIEZAS.PROG. | cuantitativo | Razón |
| TMO..MIN. | cuantitativo | Razón |
| HR..FIN | cuantitativo | Razón |
| ESTACION.ARRANQUE | cualitativo | Nominal |
| Laminas.procesadas | cuantitativo | Razón |
| INICIO.SEP.UP | cuantitativo | Razón |
| FIN.INICIO.DE.SEP.UP | cuantitativo | Razón |
| INICIO.de.PROCESO | cuantitativo | Razón |
| FIN.de.PROCESO | cuantitativo | Razón |
| TIEMPO.CALIDAD | cuantitativo | Razón |
| TIEMPO.MATERIALES | cuantitativo | Razón |
| Fecha | cuantitativo | Razón |
| Status | cualitativo | Ordinal |
### R. Remover valores irrelevantes y realizar conversión de datos. Estas técnicas ayudan a dar una mayor claridad de la información, junto con valores más precisos y relevantes. Sin estos, es muy complicado realizar un análisis descriptivo de forma certera.
### Eliminar renglones duplicados
df2<-df1
df2<-distinct(df2)
### ¿Cuántos NA's tengo en la base de datos? Primera limpieza
sum(is.na(df2))
## [1] 1644
### Eliminar columnas
df3<-df2
df3 <- subset(df3, select =-c (X))
### Borrar todos los registros NA's de una tabla
df4<-df3
df4<-na.omit(df4)
summary(df4)
## No. CLIENTE ID.FORM PRODUCTO
## Min. : 1.00 Length:302 Length:302 Length:302
## 1st Qu.: 84.25 Class :character Class :character Class :character
## Median : 557.50 Mode :character Mode :character Mode :character
## Mean : 760.62
## 3rd Qu.:1308.75
## Max. :1925.00
## PIEZAS.PROG. TMO..MIN. HR..FIN ESTACION.ARRANQUE
## Length:302 Length:302 Length:302 Length:302
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## Laminas.procesadas INICIO.SEP.UP FIN.INICIO.DE.SEP.UP INICIO.de.PROCESO
## Length:302 Length:302 Length:302 Length:302
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## FIN.de.PROCESO TIEMPO.CALIDAD TIEMPO.MATERIALES Fecha
## Length:302 Min. : 0.000 Length:302 Length:302
## Class :character 1st Qu.: 0.000 Class :character Class :character
## Mode :character Median : 0.000 Mode :character Mode :character
## Mean : 1.639
## 3rd Qu.: 1.000
## Max. :36.000
## Status
## Length:302
## Class :character
## Mode :character
##
##
##
### ¿Cuántos NA's tengo en la base de datos? Segunda limpieza
sum(is.na(df4))
## [1] 0
### Conversión de caracter a fecha
df5<-df4
df5$Fecha<-as.Date(df5$Fecha, format= "%d/%m/%Y")
summary(df5)
## No. CLIENTE ID.FORM PRODUCTO
## Min. : 1.00 Length:302 Length:302 Length:302
## 1st Qu.: 84.25 Class :character Class :character Class :character
## Median : 557.50 Mode :character Mode :character Mode :character
## Mean : 760.62
## 3rd Qu.:1308.75
## Max. :1925.00
## PIEZAS.PROG. TMO..MIN. HR..FIN ESTACION.ARRANQUE
## Length:302 Length:302 Length:302 Length:302
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## Laminas.procesadas INICIO.SEP.UP FIN.INICIO.DE.SEP.UP INICIO.de.PROCESO
## Length:302 Length:302 Length:302 Length:302
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## FIN.de.PROCESO TIEMPO.CALIDAD TIEMPO.MATERIALES Fecha
## Length:302 Min. : 0.000 Length:302 Min. :2022-08-01
## Class :character 1st Qu.: 0.000 Class :character 1st Qu.:2022-08-01
## Mode :character Median : 0.000 Mode :character Median :2022-08-06
## Mean : 1.639 Mean :2022-08-08
## 3rd Qu.: 1.000 3rd Qu.:2022-08-15
## Max. :36.000 Max. :2022-08-21
## Status
## Length:302
## Class :character
## Mode :character
##
##
##
### En la primera parte de la limpieza de datos, vemos que la variable "FECHA" estaba en formato de caracter y se generaron 4 variables adicionales (X a X.3). Al realizar las modificaciones correspondientes de conversión de datos, eliminar columnas y eliminar datos irrelevantes, se muestra que tenemos tres variables esenciales a analizar y un total de 50 registros por variable. Esto nos permitirá realizar un análisis concreto más adelante.
describe(df5)
## # A tibble: 2 × 26
## describe…¹ n na mean sd se_mean IQR skewn…² kurto…³ p00 p01
## <chr> <int> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 No. 302 0 761. 655. 37.7 1224. 0.323 -1.37 1 4.01
## 2 TIEMPO.CA… 302 0 1.64 4.51 0.260 1 4.73 27.0 0 0
## # … with 15 more variables: p05 <dbl>, p10 <dbl>, p20 <dbl>, p25 <dbl>,
## # p30 <dbl>, p40 <dbl>, p50 <dbl>, p60 <dbl>, p70 <dbl>, p75 <dbl>,
## # p80 <dbl>, p90 <dbl>, p95 <dbl>, p99 <dbl>, p100 <dbl>, and abbreviated
## # variable names ¹described_variables, ²skewness, ³kurtosis
count(df5, PIEZAS.PROG., sort = TRUE)
## PIEZAS.PROG. n
## 1 96
## 2 25 44
## 3 10 26
## 4 200 21
## 5 20 15
## 6 192 11
## 7 400 9
## 8 15 8
## 9 100 7
## 10 208 6
## 11 0 5
## 12 160 5
## 13 199 5
## 14 104 4
## 15 320 4
## 16 35 4
## 17 30 3
## 18 50 3
## 19 70 3
## 20 100ca 2
## 21 26 2
## 22 300ca 2
## 23 40 2
## 24 57 2
## 25 60 2
## 26 800 2
## 27 100ra 1
## 28 240 1
## 29 56 1
## 30 62cel 1
## 31 68 1
## 32 69cel 1
## 33 80 1
## 34 99 1
## 35 KIT 1
count(df5, TIEMPO.CALIDAD, sort = TRUE)
## TIEMPO.CALIDAD n
## 1 0 181
## 2 1 78
## 3 3 6
## 4 2 5
## 5 6 5
## 6 12 4
## 7 7 3
## 8 10 3
## 9 4 2
## 10 9 2
## 11 13 2
## 12 15 2
## 13 5 1
## 14 8 1
## 15 11 1
## 16 14 1
## 17 16 1
## 18 23 1
## 19 32 1
## 20 33 1
## 21 36 1
count(df5, TIEMPO.MATERIALES, sort = TRUE)
## TIEMPO.MATERIALES n
## 1 11:00 19
## 2 12:00 17
## 3 09:00 16
## 4 10:00 16
## 5 02:00 15
## 6 04:00 15
## 7 17:00 15
## 8 08:00 13
## 9 19:00 13
## 10 00:00 12
## 11 01:00 12
## 12 03:00 12
## 13 05:00 12
## 14 13:00 12
## 15 18:00 12
## 16 07:00 11
## 17 14:00 11
## 18 16:00 11
## 19 22:00 11
## 20 23:00 11
## 21 06:00 10
## 22 20:00 10
## 23 21:00 9
## 24 15:00 7
count(df5, Status, sort = TRUE)
## Status n
## 1 Activo 302
count(df5, CLIENTE, sort = TRUE)
## CLIENTE n
## 1 STABILUS 1 70
## 2 YANFENG 67
## 3 TRMX 42
## 4 STABILUS 3 41
## 5 VARROC 31
## 6 DENSO 22
## 7 HELLA 11
## 8 MERIDIAN LIGHTWEIGHT 10
## 9 4
## 10 STABILUS 3. 3
## 11 VL-017-14086 1
## 6.1 Tabla de frecuencia (1)
proportion <- prop.table(table(df5$CLIENTE,df5$TIEMPO.CALIDAD))
proportion %>%
kbl() %>%
kable_styling()
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 23 | 32 | 33 | 36 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0.0132450 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | |
| DENSO | 0.0364238 | 0.0298013 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 |
| HELLA | 0.0331126 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 |
| MERIDIAN LIGHTWEIGHT | 0.0231788 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 |
| STABILUS 1 | 0.1456954 | 0.0596026 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0066225 | 0.0033113 | 0.0033113 | 0.0066225 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 |
| STABILUS 3 | 0.0894040 | 0.0397351 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 |
| STABILUS 3. | 0.0099338 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 |
| TRMX | 0.1059603 | 0.0165563 | 0.0033113 | 0.0066225 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 |
| VARROC | 0.0529801 | 0.0198675 | 0.0000000 | 0.0033113 | 0.0033113 | 0.0000000 | 0.0033113 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0033113 |
| VL-017-14086 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 |
| YANFENG | 0.0860927 | 0.0927152 | 0.0099338 | 0.0099338 | 0.0000000 | 0.0000000 | 0.0132450 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0033113 | 0.0000000 |
## 6.2 Tabla cruzada (1)
proportion %>%
kbl() %>%
kable_material (c("striped","hover"))
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 23 | 32 | 33 | 36 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0.0132450 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | |
| DENSO | 0.0364238 | 0.0298013 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 |
| HELLA | 0.0331126 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 |
| MERIDIAN LIGHTWEIGHT | 0.0231788 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 |
| STABILUS 1 | 0.1456954 | 0.0596026 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0066225 | 0.0033113 | 0.0033113 | 0.0066225 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 |
| STABILUS 3 | 0.0894040 | 0.0397351 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 |
| STABILUS 3. | 0.0099338 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 |
| TRMX | 0.1059603 | 0.0165563 | 0.0033113 | 0.0066225 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 |
| VARROC | 0.0529801 | 0.0198675 | 0.0000000 | 0.0033113 | 0.0033113 | 0.0000000 | 0.0033113 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0033113 |
| VL-017-14086 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 |
| YANFENG | 0.0860927 | 0.0927152 | 0.0099338 | 0.0099338 | 0.0000000 | 0.0000000 | 0.0132450 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0000000 | 0.0033113 | 0.0033113 | 0.0000000 |
## 6.3 Gráficos de datos cuantitativos y cualitativos (2)
### Importar base de datos
df6 <-read.csv(file.choose())
summary(df6)
## No. CLIENTE ID.FORM PRODUCTO
## Min. : 1.0 Length:1946 Length:1946 Length:1946
## 1st Qu.: 487.2 Class :character Class :character Class :character
## Median : 973.5 Mode :character Mode :character Mode :character
## Mean : 973.5
## 3rd Qu.:1459.8
## Max. :1946.0
##
## PIEZAS.PROG. TMO..MIN. HR..FIN ESTACION.ARRANQUE
## Length:1946 Length:1946 Length:1946 Length:1946
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## Laminas.procesadas INICIO.SEP.UP FIN.INICIO.DE.SEP.UP INICIO.de.PROCESO
## Length:1946 Length:1946 Length:1946 Length:1946
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## FIN.de.PROCESO TIEMPO.CALIDAD TIEMPO.MATERIALES Fecha
## Length:1946 Min. : 0.000 Length:1946 Length:1946
## Class :character 1st Qu.: 0.000 Class :character Class :character
## Mode :character Median : 0.000 Mode :character Mode :character
## Mean : 1.639
## 3rd Qu.: 1.000
## Max. :36.000
## NA's :1644
## Status
## Length:1946
## Class :character
## Mode :character
##
##
##
##
describe(df6)
## # A tibble: 2 × 26
## describe…¹ n na mean sd se_mean IQR skewn…² kurto…³ p00 p01
## <chr> <int> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 No. 1946 0 974. 562. 12.7 972. 0 -1.2 1 20.4
## 2 TIEMPO.CA… 302 1644 1.64 4.51 0.260 1 4.73 27.0 0 0
## # … with 15 more variables: p05 <dbl>, p10 <dbl>, p20 <dbl>, p25 <dbl>,
## # p30 <dbl>, p40 <dbl>, p50 <dbl>, p60 <dbl>, p70 <dbl>, p75 <dbl>,
## # p80 <dbl>, p90 <dbl>, p95 <dbl>, p99 <dbl>, p100 <dbl>, and abbreviated
## # variable names ¹described_variables, ²skewness, ³kurtosis
### ¿Cuántos NA's tengo en la base de datos? Primera limpieza
sum(is.na(df6))
## [1] 1644
### Borrar todos los registros NA's de una tabla
df7<-df6
df7<-na.omit(df7)
summary(df7)
## No. CLIENTE ID.FORM PRODUCTO
## Min. : 1.00 Length:302 Length:302 Length:302
## 1st Qu.: 84.25 Class :character Class :character Class :character
## Median : 557.50 Mode :character Mode :character Mode :character
## Mean : 760.62
## 3rd Qu.:1308.75
## Max. :1925.00
## PIEZAS.PROG. TMO..MIN. HR..FIN ESTACION.ARRANQUE
## Length:302 Length:302 Length:302 Length:302
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## Laminas.procesadas INICIO.SEP.UP FIN.INICIO.DE.SEP.UP INICIO.de.PROCESO
## Length:302 Length:302 Length:302 Length:302
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## FIN.de.PROCESO TIEMPO.CALIDAD TIEMPO.MATERIALES Fecha
## Length:302 Min. : 0.000 Length:302 Length:302
## Class :character 1st Qu.: 0.000 Class :character Class :character
## Mode :character Median : 0.000 Mode :character Mode :character
## Mean : 1.639
## 3rd Qu.: 1.000
## Max. :36.000
## Status
## Length:302
## Class :character
## Mode :character
##
##
##
### ¿Cuántos NA's tengo en la base de datos? Segunda limpieza
sum(is.na(df7))
## [1] 0
## 6.3.1 Pie chart: "Clientes de FORM"
pie(prop.table(table(df7$CLIENTE)), col=c("paleturquoise","aquamarine4","azure2","cadetblue","lightblue4", "dodgerblue3","lightsteelblue","deepskyblue","paleturquoise3"), main="Clientes de FORM", las=1)
## 6.3.2 Pie chart: "Status de producción de cartón"
pie(prop.table(table(df7$Status)), col=c("aquamarine4"), main="Status de producción de cartón", las=1)
## 6.3.3 Pie chart: "Total de productos comprados por cliente"
### Importar base de datos
df8 <-read.csv(file.choose())
summary(df8)
## CLIENTE CANT_PRODUCTO
## Length:1946 Min. : 1.0
## Class :character 1st Qu.: 62.0
## Mode :character Median :190.0
## Mean :214.6
## 3rd Qu.:318.0
## Max. :560.0
## NA's :1937
describe(df8)
## # A tibble: 1 × 26
## described_…¹ n na mean sd se_mean IQR skewn…² kurto…³ p00 p01
## <chr> <int> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 CANT_PRODUC… 9 1937 215. 179. 59.6 256 0.717 0.151 1 4.6
## # … with 15 more variables: p05 <dbl>, p10 <dbl>, p20 <dbl>, p25 <dbl>,
## # p30 <dbl>, p40 <dbl>, p50 <dbl>, p60 <dbl>, p70 <dbl>, p75 <dbl>,
## # p80 <dbl>, p90 <dbl>, p95 <dbl>, p99 <dbl>, p100 <dbl>, and abbreviated
## # variable names ¹described_variables, ²skewness, ³kurtosis
### ¿Cuántos NA's tengo en la base de datos? Segunda limpieza
sum(is.na(df8))
## [1] 1937
### Borrar todos los registros NA's de una tabla
df9<-df8
df9<-na.omit(df9)
summary(df9)
## CLIENTE CANT_PRODUCTO
## Length:9 Min. : 1.0
## Class :character 1st Qu.: 62.0
## Mode :character Median :190.0
## Mean :214.6
## 3rd Qu.:318.0
## Max. :560.0
### ¿Cuántos NA's tengo en la base de datos? Segunda limpieza
sum(is.na(df9))
## [1] 0
pie(table(df7$CLIENTE), col=c("lightsalmon2","orange","coral1","orange"),
label = c("VARROC (125)","HELLA (62)","MERIDIAN LIGHTWEIGHT (46)","STABILUS 3 (309)","STABILUS 1 (560)","TRMX (320)","YANFENG (318)","DENSO (190)","VL-017-14086 (1)"),
main="Total de productos por cliente producidos en Agosto")
## 6.4 Gráficos de dispersión (3)
### Gráfica de dispersión: Dispersióm de tiempo de calidad
plot(df7$TIEMPO.CALIDAD, horizontal= TRUE,
ylim= c(0, 40),
xlim= c(0, 300),
col= c("orange"),
main= "Dispersión de Estación Arranque")
## Warning in plot.window(...): "horizontal" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "horizontal" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...): "horizontal" is not
## a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...): "horizontal" is not
## a graphical parameter
## Warning in box(...): "horizontal" is not a graphical parameter
## Warning in title(...): "horizontal" is not a graphical parameter
### Histograma
hist(df9$CANT_PRODUCTO,main="Histograma de frecuencia",xlab="Tiempo minimo",col="orange")
### Gráficos de normalidad
plot_normality(df7,TIEMPO.CALIDAD, col='#FFA07A')
Propuesta 1: Se recomienda realizar un estudio ergonómico sobre las estaciones de trabajo del área de producción con el fin de mejorar paulativamente el rendimiento de los colaboradores en sus actividades correspondientes.
Propuesta 2: Se recomienda ejecutar encuestas periódicas a los clientes con la finalidad de obtener información de satisfacción con respecto al producto entregado. De esta manera, la empresa podrá tomar las acciones correspondientes como respuesta de una política de mejora continua.
De acuerdo a los datos analizados, vemos que el cliente “VL-017-14086” es el que menos producto compra. Con los principios de ciencia de datos y gestión empresarial, es importante analizar el valor que le generamos a los clientes, pero también el valor que ellos nos generan. Se recomienda analizar qué tanto beneficio nos está generando contar con un cliente que únicamente pide una pieza. Es cuestión de evaluar si nuestro esfuerzo productivo vale la pena contra el ingreso o beneficio comercial que éste nos genere.
Angelo Santana & Carmen Nieves Hernández, U. (2022). Gráficos en R: Diagramas de barras (barplots). Retrieved 26 September 2022, from https://estadistica-dma.ulpgc.es/cursoR4ULPGC/9b-grafBarplot.html Packages, O., Power, S., Output, A., Examples, D., Questions, F., & Examples, T. et al. (2022). How can I add features or dimensions to my bar plot? | R FAQ. Retrieved 26 September 2022, from https://stats.oarc.ucla.edu/r/faq/how-can-i-add-features-or-dimensions-to-my-bar-plot/ RPubs - Función ggplot() de ggplot2. (2018). Retrieved 26 September 2022, from https://rpubs.com/daniballari/ggplot Vega, J. (2022). R para principiantes. Retrieved 26 September 2022, from https://bookdown.org/jboscomendoza/r-principiantes4/matrices-y-arrays.html