Variable discreta: bolsas plásticas blandas

0. Carga de librerías y datos

1. Descripción de los datos

La variable analizada corresponde a la cantidad de bolsas plásticas blandas registradas en cada observación.

cat("Total de observaciones:", length(bols_bland), "\n")
## Total de observaciones: 45103
cat("Datos válidos:", length(bols_bland_limpio), "\n")
## Datos válidos: 44166
cat("Datos faltantes:", sum(is.na(bols_bland)), "\n")
## Datos faltantes: 937
summary(bols_bland_limpio)
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
##      0.00      0.00      2.00     97.72     17.00 177736.00

2. Distribución de frecuencias

tabla_frecuencia <- as.data.frame(table(bols_bland_limpio))
names(tabla_frecuencia) <- c("Bolsas", "ni")

tabla_frecuencia$Bolsas <- as.numeric(as.character(tabla_frecuencia$Bolsas))
tabla_frecuencia <- tabla_frecuencia[order(tabla_frecuencia$Bolsas), ]

tabla_frecuencia$hi <- tabla_frecuencia$ni / sum(tabla_frecuencia$ni) * 100
tabla_frecuencia$Ni <- cumsum(tabla_frecuencia$ni)
tabla_frecuencia$Hi <- cumsum(tabla_frecuencia$hi)

TDFBolsasFin <- tabla_frecuencia

TDFBolsasCompleto <- data.frame(
  Bolsas = c(as.character(TDFBolsasFin$Bolsas), "Total"),
  ni = c(TDFBolsasFin$ni, sum(TDFBolsasFin$ni)),
  `hi (%)` = c(round(TDFBolsasFin$hi, 2), 100),
  check.names = FALSE
)

TDFBolsasCompleto %>%
  gt() %>%
  cols_label(
    Bolsas = "Cantidad de bolsas blandas",
    ni = "Frecuencia absoluta (ni)",
    `hi (%)` = "Frecuencia relativa (hi %)"
  ) %>%
  tab_header(
    title = md("**Tabla Nro. 1**"),
    subtitle = "Distribución de frecuencias de bolsas plásticas blandas"
  ) %>%
  cols_align(align = "center", columns = everything()) %>%
  tab_options(
    table.border.top.color = "black",
    table.border.bottom.color = "black",
    column_labels.border.bottom.color = "black",
    column_labels.border.bottom.width = px(2),
    row.striping.include_table_body = TRUE
  ) %>%
  tab_source_note(
    source_note = "Fuente: Base de datos del proyecto de contaminación por plásticos."
  )
Tabla Nro. 1
Distribución de frecuencias de bolsas plásticas blandas
Cantidad de bolsas blandas Frecuencia absoluta (ni) Frecuencia relativa (hi %)
0 14886 33.70
1 3474 7.87
2 4559 10.32
3 1795 4.06
4 1308 2.96
5 1185 2.68
6 868 1.97
7 725 1.64
8 681 1.54
9 477 1.08
10 724 1.64
11 461 1.04
12 381 0.86
13 363 0.82
14 327 0.74
15 403 0.91
16 285 0.65
17 295 0.67
18 245 0.55
19 253 0.57
20 334 0.76
21 231 0.52
22 191 0.43
23 226 0.51
24 154 0.35
25 265 0.60
26 172 0.39
27 162 0.37
28 172 0.39
29 123 0.28
30 206 0.47
31 140 0.32
32 135 0.31
33 125 0.28
34 116 0.26
35 134 0.30
36 129 0.29
37 110 0.25
38 105 0.24
39 100 0.23
40 175 0.40
41 93 0.21
42 129 0.29
43 110 0.25
44 83 0.19
45 125 0.28
46 86 0.19
47 77 0.17
48 77 0.17
49 81 0.18
50 131 0.30
51 77 0.17
52 62 0.14
53 83 0.19
54 68 0.15
55 68 0.15
56 63 0.14
57 61 0.14
58 66 0.15
59 58 0.13
60 86 0.19
61 60 0.14
62 62 0.14
63 67 0.15
64 46 0.10
65 48 0.11
66 45 0.10
67 46 0.10
68 49 0.11
69 46 0.10
70 57 0.13
71 48 0.11
72 46 0.10
73 43 0.10
74 45 0.10
75 51 0.12
76 41 0.09
77 36 0.08
78 43 0.10
79 30 0.07
80 57 0.13
81 38 0.09
82 41 0.09
83 38 0.09
84 26 0.06
85 35 0.08
86 37 0.08
87 33 0.07
88 40 0.09
89 31 0.07
90 37 0.08
91 27 0.06
92 18 0.04
93 34 0.08
94 37 0.08
95 31 0.07
96 22 0.05
97 22 0.05
98 28 0.06
99 29 0.07
100 62 0.14
101 24 0.05
102 21 0.05
103 27 0.06
104 22 0.05
105 36 0.08
106 18 0.04
107 25 0.06
108 41 0.09
109 23 0.05
110 34 0.08
111 30 0.07
112 22 0.05
113 23 0.05
114 12 0.03
115 27 0.06
116 20 0.05
117 19 0.04
118 21 0.05
119 25 0.06
120 23 0.05
121 33 0.07
122 32 0.07
123 21 0.05
124 18 0.04
125 24 0.05
126 13 0.03
127 18 0.04
128 19 0.04
129 10 0.02
130 29 0.07
131 19 0.04
132 15 0.03
133 23 0.05
134 18 0.04
135 13 0.03
136 19 0.04
137 15 0.03
138 17 0.04
139 11 0.02
140 16 0.04
141 21 0.05
142 18 0.04
143 19 0.04
144 17 0.04
145 9 0.02
146 10 0.02
147 12 0.03
148 16 0.04
149 11 0.02
150 33 0.07
151 16 0.04
152 15 0.03
153 13 0.03
154 14 0.03
155 11 0.02
156 13 0.03
157 15 0.03
158 12 0.03
159 7 0.02
160 21 0.05
161 9 0.02
162 10 0.02
163 4 0.01
164 8 0.02
165 18 0.04
166 12 0.03
167 9 0.02
168 9 0.02
169 14 0.03
170 18 0.04
171 12 0.03
172 13 0.03
173 13 0.03
174 6 0.01
175 16 0.04
176 10 0.02
177 14 0.03
178 12 0.03
179 11 0.02
180 26 0.06
181 14 0.03
182 10 0.02
183 10 0.02
184 7 0.02
185 15 0.03
186 8 0.02
187 9 0.02
188 11 0.02
189 6 0.01
190 8 0.02
191 7 0.02
192 6 0.01
193 9 0.02
194 13 0.03
195 7 0.02
196 10 0.02
197 14 0.03
198 4 0.01
199 12 0.03
200 21 0.05
201 10 0.02
202 13 0.03
203 45 0.10
204 7 0.02
205 7 0.02
206 7 0.02
207 3 0.01
208 8 0.02
209 5 0.01
210 12 0.03
211 9 0.02
212 3 0.01
213 3 0.01
214 5 0.01
215 7 0.02
216 6 0.01
217 3 0.01
218 8 0.02
219 6 0.01
220 10 0.02
221 10 0.02
222 6 0.01
223 9 0.02
224 5 0.01
225 7 0.02
226 5 0.01
227 5 0.01
228 14 0.03
229 4 0.01
230 9 0.02
231 11 0.02
232 4 0.01
233 9 0.02
234 4 0.01
235 6 0.01
236 6 0.01
237 6 0.01
238 1 0.00
239 5 0.01
240 7 0.02
241 8 0.02
242 10 0.02
243 7 0.02
244 9 0.02
245 3 0.01
246 6 0.01
247 6 0.01
248 3 0.01
249 8 0.02
250 8 0.02
251 7 0.02
252 5 0.01
253 3 0.01
254 8 0.02
255 6 0.01
256 4 0.01
257 9 0.02
258 5 0.01
259 7 0.02
260 5 0.01
261 5 0.01
262 10 0.02
263 4 0.01
264 4 0.01
265 5 0.01
266 5 0.01
267 6 0.01
268 6 0.01
269 3 0.01
270 4 0.01
271 8 0.02
272 6 0.01
273 7 0.02
274 5 0.01
275 4 0.01
276 5 0.01
278 5 0.01
279 6 0.01
280 10 0.02
281 1 0.00
282 6 0.01
283 5 0.01
284 2 0.00
285 5 0.01
286 3 0.01
287 2 0.00
288 3 0.01
289 8 0.02
290 6 0.01
291 2 0.00
292 5 0.01
293 5 0.01
294 4 0.01
295 1 0.00
296 9 0.02
297 3 0.01
298 2 0.00
299 7 0.02
300 12 0.03
301 2 0.00
302 8 0.02
303 4 0.01
304 6 0.01
305 3 0.01
306 3 0.01
307 3 0.01
308 5 0.01
309 10 0.02
310 4 0.01
311 3 0.01
312 3 0.01
313 5 0.01
314 3 0.01
315 5 0.01
316 1 0.00
317 4 0.01
318 4 0.01
319 4 0.01
320 6 0.01
321 7 0.02
322 2 0.00
323 3 0.01
324 2 0.00
326 4 0.01
327 3 0.01
328 4 0.01
329 1 0.00
330 7 0.02
331 2 0.00
332 5 0.01
333 4 0.01
334 6 0.01
335 3 0.01
336 2 0.00
337 2 0.00
338 2 0.00
339 5 0.01
340 4 0.01
341 4 0.01
344 1 0.00
346 1 0.00
347 2 0.00
348 3 0.01
349 3 0.01
350 13 0.03
351 3 0.01
352 3 0.01
353 4 0.01
354 2 0.00
355 4 0.01
356 3 0.01
357 4 0.01
358 3 0.01
359 3 0.01
360 4 0.01
361 2 0.00
362 2 0.00
363 3 0.01
364 4 0.01
365 2 0.00
366 4 0.01
367 2 0.00
368 1 0.00
369 5 0.01
370 6 0.01
371 3 0.01
372 3 0.01
373 1 0.00
374 4 0.01
375 1 0.00
376 2 0.00
377 2 0.00
378 4 0.01
379 4 0.01
380 1 0.00
381 1 0.00
382 8 0.02
383 1 0.00
384 4 0.01
385 2 0.00
386 4 0.01
387 4 0.01
389 4 0.01
390 1 0.00
391 2 0.00
392 4 0.01
393 1 0.00
394 2 0.00
396 3 0.01
397 2 0.00
398 1 0.00
399 2 0.00
400 12 0.03
401 2 0.00
402 3 0.01
403 3 0.01
404 3 0.01
405 4 0.01
406 1 0.00
407 3 0.01
408 3 0.01
409 5 0.01
410 3 0.01
412 2 0.00
413 1 0.00
414 2 0.00
415 5 0.01
416 4 0.01
417 2 0.00
418 1 0.00
419 3 0.01
420 1 0.00
421 4 0.01
422 4 0.01
423 1 0.00
424 3 0.01
425 4 0.01
426 2 0.00
427 4 0.01
428 2 0.00
429 6 0.01
430 6 0.01
431 3 0.01
432 1 0.00
433 4 0.01
434 2 0.00
436 3 0.01
437 3 0.01
438 3 0.01
439 1 0.00
440 4 0.01
441 1 0.00
442 3 0.01
443 1 0.00
444 2 0.00
445 7 0.02
446 2 0.00
447 1 0.00
448 2 0.00
450 7 0.02
452 1 0.00
453 2 0.00
454 1 0.00
455 1 0.00
456 3 0.01
457 1 0.00
459 2 0.00
461 1 0.00
462 4 0.01
463 2 0.00
464 1 0.00
465 1 0.00
466 1 0.00
467 1 0.00
468 1 0.00
469 1 0.00
470 3 0.01
471 1 0.00
472 3 0.01
473 2 0.00
475 4 0.01
476 2 0.00
478 3 0.01
480 1 0.00
481 4 0.01
482 3 0.01
484 1 0.00
485 2 0.00
486 1 0.00
488 2 0.00
489 2 0.00
490 7 0.02
492 2 0.00
493 2 0.00
494 1 0.00
495 1 0.00
497 1 0.00
498 2 0.00
499 1 0.00
500 8 0.02
501 2 0.00
502 2 0.00
503 2 0.00
505 4 0.01
507 2 0.00
509 1 0.00
511 1 0.00
513 1 0.00
514 1 0.00
516 1 0.00
517 2 0.00
519 1 0.00
520 5 0.01
521 3 0.01
522 2 0.00
523 2 0.00
524 2 0.00
525 1 0.00
526 1 0.00
527 3 0.01
530 4 0.01
531 1 0.00
532 3 0.01
533 2 0.00
534 1 0.00
535 3 0.01
536 1 0.00
537 7 0.02
538 1 0.00
539 1 0.00
540 1 0.00
541 4 0.01
544 1 0.00
545 1 0.00
546 1 0.00
547 2 0.00
548 1 0.00
549 2 0.00
550 8 0.02
551 1 0.00
552 1 0.00
553 1 0.00
555 3 0.01
556 2 0.00
558 1 0.00
559 1 0.00
560 2 0.00
562 2 0.00
563 1 0.00
564 1 0.00
565 1 0.00
566 2 0.00
567 1 0.00
568 2 0.00
569 2 0.00
570 2 0.00
571 4 0.01
572 1 0.00
573 1 0.00
574 2 0.00
576 3 0.01
577 1 0.00
580 5 0.01
582 2 0.00
584 1 0.00
585 2 0.00
586 4 0.01
587 1 0.00
588 1 0.00
590 1 0.00
592 2 0.00
593 1 0.00
594 2 0.00
595 2 0.00
596 1 0.00
598 1 0.00
599 1 0.00
600 3 0.01
601 1 0.00
604 1 0.00
605 2 0.00
606 1 0.00
608 3 0.01
610 3 0.01
613 2 0.00
614 2 0.00
615 1 0.00
616 1 0.00
619 1 0.00
620 2 0.00
621 1 0.00
622 1 0.00
623 1 0.00
625 2 0.00
626 6 0.01
627 1 0.00
628 4 0.01
629 1 0.00
630 2 0.00
631 1 0.00
632 2 0.00
633 1 0.00
635 1 0.00
636 1 0.00
640 4 0.01
641 2 0.00
642 4 0.01
644 2 0.00
645 2 0.00
646 2 0.00
647 2 0.00
648 1 0.00
650 1 0.00
655 3 0.01
657 1 0.00
659 1 0.00
660 2 0.00
661 1 0.00
663 2 0.00
664 1 0.00
665 2 0.00
666 2 0.00
667 1 0.00
670 1 0.00
671 2 0.00
672 2 0.00
678 1 0.00
679 1 0.00
680 3 0.01
687 3 0.01
688 1 0.00
690 3 0.01
694 3 0.01
695 1 0.00
696 1 0.00
697 1 0.00
698 3 0.01
700 4 0.01
701 1 0.00
702 1 0.00
703 1 0.00
704 1 0.00
705 1 0.00
706 1 0.00
708 2 0.00
709 1 0.00
711 5 0.01
712 1 0.00
715 1 0.00
717 2 0.00
718 1 0.00
720 2 0.00
721 2 0.00
722 1 0.00
723 2 0.00
726 1 0.00
727 1 0.00
733 1 0.00
739 1 0.00
740 1 0.00
743 1 0.00
745 2 0.00
748 2 0.00
750 1 0.00
752 3 0.01
753 1 0.00
755 1 0.00
759 2 0.00
762 1 0.00
764 1 0.00
766 1 0.00
771 2 0.00
772 1 0.00
773 1 0.00
775 1 0.00
778 1 0.00
779 1 0.00
782 1 0.00
795 1 0.00
796 1 0.00
798 1 0.00
800 3 0.01
802 3 0.01
803 1 0.00
804 2 0.00
806 1 0.00
807 2 0.00
809 1 0.00
810 1 0.00
811 1 0.00
812 2 0.00
813 3 0.01
815 2 0.00
820 2 0.00
823 1 0.00
829 2 0.00
830 1 0.00
834 2 0.00
837 2 0.00
838 2 0.00
839 1 0.00
840 1 0.00
845 1 0.00
846 2 0.00
847 1 0.00
848 3 0.01
850 1 0.00
851 1 0.00
852 1 0.00
853 2 0.00
854 1 0.00
858 3 0.01
866 1 0.00
872 1 0.00
873 1 0.00
875 2 0.00
877 1 0.00
878 1 0.00
882 1 0.00
883 1 0.00
884 1 0.00
885 1 0.00
887 2 0.00
888 3 0.01
889 1 0.00
891 1 0.00
894 2 0.00
895 1 0.00
897 1 0.00
900 3 0.01
902 1 0.00
905 1 0.00
906 1 0.00
908 1 0.00
912 1 0.00
916 2 0.00
918 1 0.00
923 2 0.00
925 1 0.00
930 2 0.00
932 1 0.00
933 1 0.00
937 1 0.00
938 1 0.00
939 1 0.00
944 1 0.00
948 2 0.00
952 2 0.00
953 1 0.00
961 1 0.00
963 1 0.00
972 1 0.00
975 1 0.00
976 1 0.00
981 1 0.00
987 3 0.01
989 1 0.00
990 1 0.00
1000 3 0.01
1008 1 0.00
1010 3 0.01
1013 1 0.00
1014 1 0.00
1017 1 0.00
1026 3 0.01
1030 2 0.00
1031 1 0.00
1034 1 0.00
1035 1 0.00
1039 1 0.00
1043 1 0.00
1048 1 0.00
1050 3 0.01
1056 2 0.00
1062 1 0.00
1065 2 0.00
1066 1 0.00
1068 1 0.00
1073 1 0.00
1074 1 0.00
1078 1 0.00
1087 2 0.00
1089 1 0.00
1097 1 0.00
1100 1 0.00
1103 1 0.00
1104 1 0.00
1105 1 0.00
1107 1 0.00
1110 1 0.00
1111 1 0.00
1113 1 0.00
1114 1 0.00
1115 2 0.00
1116 1 0.00
1120 1 0.00
1126 1 0.00
1128 2 0.00
1138 1 0.00
1146 1 0.00
1147 1 0.00
1149 1 0.00
1150 1 0.00
1151 1 0.00
1152 1 0.00
1155 1 0.00
1166 1 0.00
1175 1 0.00
1178 1 0.00
1179 1 0.00
1181 1 0.00
1183 1 0.00
1184 1 0.00
1187 1 0.00
1189 1 0.00
1193 1 0.00
1200 1 0.00
1208 1 0.00
1209 1 0.00
1236 1 0.00
1237 1 0.00
1239 1 0.00
1243 1 0.00
1247 1 0.00
1248 1 0.00
1254 1 0.00
1257 1 0.00
1258 1 0.00
1270 1 0.00
1283 2 0.00
1300 2 0.00
1309 1 0.00
1310 1 0.00
1321 1 0.00
1325 1 0.00
1326 1 0.00
1333 1 0.00
1342 1 0.00
1344 1 0.00
1348 1 0.00
1358 1 0.00
1359 1 0.00
1370 1 0.00
1372 1 0.00
1380 1 0.00
1383 1 0.00
1387 3 0.01
1389 3 0.01
1391 1 0.00
1401 1 0.00
1403 1 0.00
1412 1 0.00
1414 1 0.00
1428 1 0.00
1430 1 0.00
1433 1 0.00
1436 1 0.00
1438 1 0.00
1443 1 0.00
1445 1 0.00
1446 1 0.00
1448 1 0.00
1451 2 0.00
1454 1 0.00
1463 1 0.00
1467 1 0.00
1471 1 0.00
1474 1 0.00
1487 1 0.00
1494 1 0.00
1500 1 0.00
1509 1 0.00
1510 1 0.00
1511 1 0.00
1540 1 0.00
1548 1 0.00
1557 1 0.00
1559 2 0.00
1562 1 0.00
1581 1 0.00
1597 1 0.00
1598 1 0.00
1600 2 0.00
1604 1 0.00
1606 1 0.00
1621 2 0.00
1623 1 0.00
1630 1 0.00
1662 1 0.00
1664 1 0.00
1680 1 0.00
1683 1 0.00
1690 1 0.00
1698 1 0.00
1706 1 0.00
1710 1 0.00
1715 1 0.00
1720 1 0.00
1732 1 0.00
1737 1 0.00
1740 1 0.00
1751 1 0.00
1761 1 0.00
1765 1 0.00
1767 1 0.00
1768 2 0.00
1769 1 0.00
1790 1 0.00
1797 1 0.00
1800 1 0.00
1805 1 0.00
1815 1 0.00
1817 1 0.00
1827 1 0.00
1829 1 0.00
1842 1 0.00
1856 1 0.00
1860 2 0.00
1888 1 0.00
1921 1 0.00
1929 1 0.00
1948 1 0.00
1951 1 0.00
1956 1 0.00
1969 1 0.00
1973 1 0.00
1974 1 0.00
1978 1 0.00
1987 1 0.00
1990 1 0.00
2006 1 0.00
2021 1 0.00
2023 1 0.00
2030 1 0.00
2043 1 0.00
2066 1 0.00
2082 2 0.00
2093 1 0.00
2100 1 0.00
2106 1 0.00
2143 1 0.00
2150 1 0.00
2154 1 0.00
2215 1 0.00
2222 1 0.00
2227 1 0.00
2248 1 0.00
2275 1 0.00
2279 1 0.00
2289 1 0.00
2299 1 0.00
2300 1 0.00
2301 1 0.00
2314 1 0.00
2330 1 0.00
2337 1 0.00
2348 1 0.00
2350 1 0.00
2383 1 0.00
2386 1 0.00
2392 1 0.00
2393 1 0.00
2419 1 0.00
2437 1 0.00
2446 1 0.00
2449 1 0.00
2455 1 0.00
2467 1 0.00
2475 1 0.00
2486 1 0.00
2503 1 0.00
2510 1 0.00
2526 1 0.00
2595 1 0.00
2600 1 0.00
2658 1 0.00
2704 1 0.00
2705 1 0.00
2723 1 0.00
2743 1 0.00
2750 1 0.00
2761 1 0.00
2769 1 0.00
2776 1 0.00
2787 1 0.00
2795 1 0.00
2802 1 0.00
2813 1 0.00
2821 1 0.00
2826 1 0.00
2880 1 0.00
2883 1 0.00
2887 1 0.00
2920 1 0.00
2932 1 0.00
2974 1 0.00
3000 1 0.00
3015 1 0.00
3020 1 0.00
3025 1 0.00
3038 2 0.00
3053 1 0.00
3074 1 0.00
3080 1 0.00
3082 1 0.00
3085 1 0.00
3087 2 0.00
3090 1 0.00
3099 1 0.00
3156 1 0.00
3195 1 0.00
3205 1 0.00
3263 1 0.00
3344 1 0.00
3354 1 0.00
3390 1 0.00
3403 1 0.00
3520 1 0.00
3522 1 0.00
3588 1 0.00
3603 1 0.00
3653 1 0.00
3829 1 0.00
3859 1 0.00
3873 1 0.00
3894 1 0.00
3962 1 0.00
3996 1 0.00
4067 1 0.00
4101 1 0.00
4119 1 0.00
4268 1 0.00
4308 1 0.00
4332 1 0.00
4355 2 0.00
4556 1 0.00
4589 1 0.00
4634 1 0.00
4652 1 0.00
4687 1 0.00
4784 1 0.00
4840 1 0.00
4862 1 0.00
4923 1 0.00
4941 1 0.00
5000 1 0.00
5114 1 0.00
5142 1 0.00
5156 1 0.00
5174 1 0.00
5403 1 0.00
5629 1 0.00
5637 1 0.00
5669 1 0.00
5770 1 0.00
5820 1 0.00
5828 1 0.00
5843 1 0.00
5949 1 0.00
5952 1 0.00
6019 1 0.00
6040 1 0.00
6071 1 0.00
6100 1 0.00
6164 1 0.00
6282 1 0.00
6500 1 0.00
6692 1 0.00
6791 1 0.00
6884 1 0.00
7025 1 0.00
7225 1 0.00
7247 1 0.00
7281 1 0.00
7317 1 0.00
7412 1 0.00
7472 1 0.00
7615 1 0.00
7630 1 0.00
7723 1 0.00
8138 1 0.00
8147 1 0.00
8234 1 0.00
8480 1 0.00
8520 1 0.00
8816 1 0.00
9186 1 0.00
9597 1 0.00
9934 1 0.00
10030 1 0.00
10086 1 0.00
10128 1 0.00
10532 1 0.00
10823 1 0.00
11633 1 0.00
11961 1 0.00
12311 1 0.00
12450 1 0.00
13673 1 0.00
14969 1 0.00
15188 1 0.00
15249 1 0.00
15366 1 0.00
16243 1 0.00
16436 1 0.00
16620 1 0.00
18320 1 0.00
18542 1 0.00
20567 1 0.00
22574 1 0.00
23138 1 0.00
27976 1 0.00
28207 1 0.00
30190 1 0.00
30271 1 0.00
30330 1 0.00
31068 1 0.00
31805 1 0.00
32359 1 0.00
33314 1 0.00
40847 1 0.00
44552 1 0.00
45632 1 0.00
46617 1 0.00
58113 1 0.00
60333 1 0.00
61479 1 0.00
65340 1 0.00
66318 1 0.00
67862 1 0.00
69308 1 0.00
97525 1 0.00
120533 1 0.00
137346 1 0.00
149625 1 0.00
167720 1 0.00
177736 1 0.00
Total 44166 100.00
Fuente: Base de datos del proyecto de contaminación por plásticos.

3. Gráficos de distribución de frecuencias

Nota: la variable presenta muchos valores distintos. Para que los diagramas de barras sean legibles, se muestran los 20 valores con mayor frecuencia. La tabla de frecuencias anterior conserva todos los valores observados.

top20 <- TDFBolsasFin %>%
  arrange(desc(ni), Bolsas) %>%
  slice_head(n = 20) %>%
  arrange(Bolsas)

3.1 Frecuencia absoluta

barplot(
  height = top20$ni,
  names.arg = top20$Bolsas,
  main = "Gráfico Nro. 1: Frecuencia absoluta",
  xlab = "Cantidad de bolsas blandas",
  ylab = "Frecuencia absoluta",
  col = "skyblue3",
  las = 2,
  cex.names = 0.75
)

3.2 Frecuencia absoluta con respecto al total

barplot(
  height = top20$ni,
  names.arg = top20$Bolsas,
  main = "Gráfico Nro. 2: Frecuencia absoluta de los 20 valores más frecuentes",
  xlab = "Cantidad de bolsas blandas",
  ylab = "Frecuencia absoluta",
  col = "skyblue3",
  las = 2,
  cex.names = 0.75,
  ylim = c(0, max(top20$ni) * 1.15)
)

3.3 Frecuencia relativa porcentual

barplot(
  height = top20$hi,
  names.arg = top20$Bolsas,
  main = "Gráfico Nro. 3: Frecuencia relativa porcentual",
  xlab = "Cantidad de bolsas blandas",
  ylab = "Porcentaje (%)",
  col = "steelblue3",
  las = 2,
  cex.names = 0.75,
  ylim = c(0, max(top20$hi) * 1.15)
)

3.4 Frecuencia porcentual con respecto al total

barplot(
  height = top20$hi,
  names.arg = top20$Bolsas,
  main = "Gráfico Nro. 4: Porcentaje de los 20 valores más frecuentes",
  xlab = "Cantidad de bolsas blandas",
  ylab = "Porcentaje (%)",
  col = "steelblue3",
  las = 2,
  cex.names = 0.75,
  ylim = c(0, max(top20$hi) * 1.15)
)

4. Diagrama de caja

boxplot(
  bols_bland_limpio,
  horizontal = TRUE,
  main = "Gráfico Nro. 5: Diagrama de caja de bolsas plásticas blandas",
  xlab = "Cantidad de bolsas blandas",
  col = "#76D7C4",
  border = "black"
)
grid(nx = NA, ny = NULL, col = "gray85", lty = 1)

5. Diagramas de ojivas

Bolsas_Asc <- TDFBolsasFin$Bolsas
ni_Asc <- TDFBolsasFin$ni
Ni_Asc <- cumsum(ni_Asc)
Ni_Desc <- rev(cumsum(rev(ni_Asc)))
N <- sum(ni_Asc)

Hi_Asc <- Ni_Asc / N * 100
Hi_Desc <- Ni_Desc / N * 100

5.1 Ojivas absolutas

plot(
  Bolsas_Asc, Ni_Asc,
  type = "l", col = "orange", lwd = 2,
  main = "Gráfico Nro. 6: Ojivas de frecuencia acumulada",
  xlab = "Cantidad de bolsas blandas",
  ylab = "Frecuencia acumulada",
  ylim = c(0, N)
)
lines(Bolsas_Asc, Ni_Desc, type = "l", col = "blue", lwd = 2)
legend(
  "right",
  legend = c("Ascendente (menor que)", "Descendente (mayor que)"),
  col = c("orange", "blue"), lty = 1, lwd = 2, bty = "n"
)
grid(col = "gray85", lty = 1)

5.2 Ojivas porcentuales

plot(
  Bolsas_Asc, Hi_Asc,
  type = "l", col = "orange", lwd = 2,
  main = "Gráfico Nro. 7: Ojivas de frecuencia acumulada porcentual",
  xlab = "Cantidad de bolsas blandas",
  ylab = "Frecuencia acumulada (%)",
  ylim = c(0, 100)
)
lines(Bolsas_Asc, Hi_Desc, type = "l", col = "blue", lwd = 2)
legend(
  "right",
  legend = c("Ascendente (menor que)", "Descendente (mayor que)"),
  col = c("orange", "blue"), lty = 1, lwd = 2, bty = "n"
)
axis(2, at = seq(0, 100, 20), labels = paste0(seq(0, 100, 20), "%"))
grid(col = "gray85", lty = 1)

6. Indicadores estadísticos

media <- mean(bols_bland_limpio)
mediana <- median(bols_bland_limpio)

tabla_moda <- table(bols_bland_limpio)
moda <- names(tabla_moda)[tabla_moda == max(tabla_moda)]
moda <- paste(moda, collapse = ", ")

rango <- paste(min(bols_bland_limpio), "-", max(bols_bland_limpio))
varianza <- var(bols_bland_limpio)
desviacion <- sd(bols_bland_limpio)

cv <- if (media != 0) desviacion / media * 100 else NA_real_

asimetria <- e1071::skewness(bols_bland_limpio, type = 2)
curtosis <- e1071::kurtosis(bols_bland_limpio, type = 2)

Q1 <- unname(quantile(bols_bland_limpio, 0.25))
Q3 <- unname(quantile(bols_bland_limpio, 0.75))
RIC <- IQR(bols_bland_limpio)
LI <- Q1 - 1.5 * RIC
LS <- Q3 + 1.5 * RIC

cantidad_atipicos <- sum(
  bols_bland_limpio < LI | bols_bland_limpio > LS
)

Tabla_indicadores <- data.frame(
  Medida = c(
    "Media",
    "Mediana",
    "Moda",
    "Rango",
    "Varianza",
    "Desviación estándar",
    "Coeficiente de variación (%)",
    "Asimetría",
    "Curtosis",
    "Cantidad de valores atípicos"
  ),
  Valor = c(
    as.character(round(media, 2)),
    as.character(round(mediana, 2)),
    moda,
    rango,
    as.character(round(varianza, 2)),
    as.character(round(desviacion, 2)),
    as.character(round(cv, 2)),
    as.character(round(asimetria, 2)),
    as.character(round(curtosis, 2)),
    as.character(cantidad_atipicos)
  )
)

Tabla_indicadores %>%
  gt() %>%
  tab_header(
    title = md("**Tabla Nro. 2**"),
    subtitle = "Indicadores estadísticos de bolsas plásticas blandas"
  ) %>%
  cols_align(align = "center", columns = everything()) %>%
  tab_options(
    table.border.top.color = "black",
    table.border.bottom.color = "black",
    column_labels.border.bottom.color = "black",
    column_labels.border.bottom.width = px(2),
    row.striping.include_table_body = TRUE
  ) %>%
  tab_source_note(
    source_note = "Fuente: Base de datos del proyecto de contaminación por plásticos."
  )
Tabla Nro. 2
Indicadores estadísticos de bolsas plásticas blandas
Medida Valor
Media 97.72
Mediana 2
Moda 0
Rango 0 - 177736
Varianza 4054546.25
Desviación estándar 2013.59
Coeficiente de variación (%) 2060.51
Asimetría 59.59
Curtosis 4247.63
Cantidad de valores atípicos 6744
Fuente: Base de datos del proyecto de contaminación por plásticos.

7. Conclusión

cat(
  "La variable bolsas plásticas blandas presenta un valor mínimo de",
  min(bols_bland_limpio),
  "y un valor máximo de",
  max(bols_bland_limpio),
  ". La media es",
  round(media, 2),
  "y la mediana es",
  round(mediana, 2),
  ". Se analizaron",
  length(bols_bland_limpio),
  "observaciones válidas y se identificaron",
  cantidad_atipicos,
  "valores atípicos mediante el criterio de 1,5 veces el rango intercuartílico."
)
## La variable bolsas plásticas blandas presenta un valor mínimo de 0 y un valor máximo de 177736 . La media es 97.72 y la mediana es 2 . Se analizaron 44166 observaciones válidas y se identificaron 6744 valores atípicos mediante el criterio de 1,5 veces el rango intercuartílico.