library(readr) # Cargar datos csv
library(fdth) # Tablas de frecuencias
alumnos <- read.csv("https://raw.githubusercontent.com/rpizarrog/probabilidad-y-estad-stica/master/datos/promedios%20alumnos/datos%20alumnos%20promedios%20SEP%202020.csv")
head(alumnos) # Los primeros seis registros
## No..Control Alumno Semestre Cr..Apr. Carga Promedio Carrera
## 1 20190001 1 11 198 19 80.21 SISTEMAS
## 2 20190002 2 11 235 10 84.33 SISTEMAS
## 3 20190003 3 9 235 10 95.25 SISTEMAS
## 4 20190004 4 9 226 19 95.00 SISTEMAS
## 5 20190005 5 10 231 14 82.32 SISTEMAS
## 6 20190006 6 9 212 23 95.02 SISTEMAS
primer_semestre <- subset(alumnos, Semestre == 1)
tabla.frecuencia <- fdt_cat(primer_semestre$Carrera)
tabla.frecuencia
## Category f rf rf(%) cf cf(%)
## ARQUITECTURA 128 0.12 12.42 128 12.42
## GESTION EMPRESARIAL 89 0.09 8.63 217 21.05
## QUIMICA 89 0.09 8.63 306 29.68
## INDUSTRIAL 88 0.09 8.54 394 38.22
## CIVIL 86 0.08 8.34 480 46.56
## BIOQUIMICA 84 0.08 8.15 564 54.70
## ADMINISTRACION 83 0.08 8.05 647 62.75
## SISTEMAS 78 0.08 7.57 725 70.32
## ELECTRICA 77 0.07 7.47 802 77.79
## MECANICA 76 0.07 7.37 878 85.16
## MECATRONICA 70 0.07 6.79 948 91.95
## ELECTRONICA 36 0.03 3.49 984 95.44
## INFORMATICA 30 0.03 2.91 1014 98.35
## TIC 17 0.02 1.65 1031 100.00
barplot(height = tabla.frecuencia$f,
names.arg = tabla.frecuencia$Category,
main = "Frecuencia de Alumnos de Primer Semestre")
tabla.frecuencia.todos <- fdt_cat(alumnos$Carrera)
tabla.frecuencia.todos
## Category f rf rf(%) cf cf(%)
## INDUSTRIAL 707 0.12 11.92 707 11.92
## ARQUITECTURA 675 0.11 11.38 1382 23.31
## CIVIL 648 0.11 10.93 2030 34.24
## GESTION EMPRESARIAL 585 0.10 9.87 2615 44.11
## QUIMICA 568 0.10 9.58 3183 53.69
## ADMINISTRACION 497 0.08 8.38 3680 62.07
## SISTEMAS 452 0.08 7.62 4132 69.69
## BIOQUIMICA 441 0.07 7.44 4573 77.13
## MECATRONICA 432 0.07 7.29 5005 84.42
## MECANICA 301 0.05 5.08 5306 89.49
## ELECTRICA 280 0.05 4.72 5586 94.21
## ELECTRONICA 161 0.03 2.72 5747 96.93
## INFORMATICA 101 0.02 1.70 5848 98.63
## TIC 81 0.01 1.37 5929 100.00
barplot(height = tabla.frecuencia.todos$f,
names.arg = tabla.frecuencia.todos$Category,
main = "Frecuencia de Alumnos inscritos por Carrera")
SISTEMAS <- subset(alumnos, Carrera == "SISTEMAS")
# cATEGORIZAR AL SEMESTRE, No hay operaciones artiméticas con Semestre
SISTEMAS$Semestre <- factor(SISTEMAS$Semestre)
tabla_frecuencia.SIS <- fdt_cat(SISTEMAS$Semestre)
tabla_frecuencia.SIS
## Category f rf rf(%) cf cf(%)
## 1 78 0.17 17.26 78 17.26
## 3 64 0.14 14.16 142 31.42
## 7 58 0.13 12.83 200 44.25
## 5 51 0.11 11.28 251 55.53
## 8 46 0.10 10.18 297 65.71
## 4 38 0.08 8.41 335 74.12
## 9 35 0.08 7.74 370 81.86
## 2 29 0.06 6.42 399 88.27
## 10 15 0.03 3.32 414 91.59
## 11 15 0.03 3.32 429 94.91
## 6 14 0.03 3.10 443 98.01
## 13 5 0.01 1.11 448 99.12
## 12 4 0.01 0.88 452 100.00
INDUSTRIAL <- subset(alumnos, Carrera == "INDUSTRIAL")
# cATEGORIZAR AL SEMESTRE, No hay operaciones artiméticas con Semestre
INDUSTRIAL$Semestre <- factor(INDUSTRIAL$Semestre)
tabla_frecuencia.IND <- fdt_cat(INDUSTRIAL$Semestre)
tabla_frecuencia.IND
## Category f rf rf(%) cf cf(%)
## 1 88 0.12 12.45 88 12.45
## 3 87 0.12 12.31 175 24.75
## 5 82 0.12 11.60 257 36.35
## 7 77 0.11 10.89 334 47.24
## 6 76 0.11 10.75 410 57.99
## 2 75 0.11 10.61 485 68.60
## 4 69 0.10 9.76 554 78.36
## 8 69 0.10 9.76 623 88.12
## 9 38 0.05 5.37 661 93.49
## 10 24 0.03 3.39 685 96.89
## 11 8 0.01 1.13 693 98.02
## 12 6 0.01 0.85 699 98.87
## 14 5 0.01 0.71 704 99.58
## 13 3 0.00 0.42 707 100.00
ARQUITECTURA <- subset(alumnos, Carrera == "ARQUITECTURA")
# cATEGORIZAR AL SEMESTRE, No hay operaciones artiméticas con Semestre
ARQUITECTURA$Semestre <- factor(ARQUITECTURA$Semestre)
tabla_frecuencia.ARQ <- fdt_cat(ARQUITECTURA$Semestre)
tabla_frecuencia.ARQ
## Category f rf rf(%) cf cf(%)
## 1 128 0.19 18.96 128 18.96
## 2 87 0.13 12.89 215 31.85
## 3 66 0.10 9.78 281 41.63
## 6 64 0.09 9.48 345 51.11
## 4 62 0.09 9.19 407 60.30
## 8 60 0.09 8.89 467 69.19
## 5 58 0.09 8.59 525 77.78
## 7 53 0.08 7.85 578 85.63
## 9 47 0.07 6.96 625 92.59
## 10 31 0.05 4.59 656 97.19
## 12 11 0.02 1.63 667 98.81
## 11 8 0.01 1.19 675 100.00
CIVIL <- subset(alumnos, Carrera == "CIVIL")
# cATEGORIZAR AL SEMESTRE, No hay operaciones artiméticas con Semestre
CIVIL$Semestre <- factor(CIVIL$Semestre)
tabla_frecuencia.CIV <- fdt_cat(CIVIL$Semestre)
tabla_frecuencia.CIV
## Category f rf rf(%) cf cf(%)
## 1 86 0.13 13.27 86 13.27
## 2 74 0.11 11.42 160 24.69
## 6 72 0.11 11.11 232 35.80
## 5 71 0.11 10.96 303 46.76
## 3 66 0.10 10.19 369 56.94
## 4 66 0.10 10.19 435 67.13
## 7 58 0.09 8.95 493 76.08
## 8 57 0.09 8.80 550 84.88
## 9 44 0.07 6.79 594 91.67
## 10 30 0.05 4.63 624 96.30
## 12 15 0.02 2.31 639 98.61
## 11 8 0.01 1.23 647 99.85
## 15 1 0.00 0.15 648 100.00
GESTIONEMPRESARIAL <- subset(alumnos, Carrera == "GESTION EMPRESARIAL")
# cATEGORIZAR AL SEMESTRE, No hay operaciones artiméticas con Semestre
GESTIONEMPRESARIAL$Semestre <- factor(GESTIONEMPRESARIAL$Semestre)
tabla_frecuencia.GES <- fdt_cat(GESTIONEMPRESARIAL$Semestre)
tabla_frecuencia.GES
## Category f rf rf(%) cf cf(%)
## 1 89 0.15 15.21 89 15.21
## 3 73 0.12 12.48 162 27.69
## 5 67 0.11 11.45 229 39.15
## 8 63 0.11 10.77 292 49.91
## 7 58 0.10 9.91 350 59.83
## 6 54 0.09 9.23 404 69.06
## 9 48 0.08 8.21 452 77.26
## 2 41 0.07 7.01 493 84.27
## 4 40 0.07 6.84 533 91.11
## 10 29 0.05 4.96 562 96.07
## 11 16 0.03 2.74 578 98.80
## 12 6 0.01 1.03 584 99.83
## 13 1 0.00 0.17 585 100.00
QUIMICA <- subset(alumnos, Carrera == "QUIMICA")
# cATEGORIZAR AL SEMESTRE, No hay operaciones artiméticas con Semestre
QUIMICA$Semestre <- factor(QUIMICA$Semestre)
tabla_frecuencia.QUI <- fdt_cat(QUIMICA$Semestre)
tabla_frecuencia.QUI
## Category f rf rf(%) cf cf(%)
## 1 89 0.16 15.67 89 15.67
## 3 77 0.14 13.56 166 29.23
## 2 65 0.11 11.44 231 40.67
## 5 65 0.11 11.44 296 52.11
## 7 58 0.10 10.21 354 62.32
## 9 57 0.10 10.04 411 72.36
## 8 54 0.10 9.51 465 81.87
## 4 39 0.07 6.87 504 88.73
## 6 32 0.06 5.63 536 94.37
## 10 19 0.03 3.35 555 97.71
## 11 8 0.01 1.41 563 99.12
## 12 4 0.01 0.70 567 99.82
## 13 1 0.00 0.18 568 100.00
ADMINISTRACION <- subset(alumnos, Carrera == "ADMINISTRACION")
# cATEGORIZAR AL SEMESTRE, No hay operaciones artiméticas con Semestre
ADMINISTRACION$Semestre <- factor(ADMINISTRACION$Semestre)
tabla_frecuencia.ADM <- fdt_cat(ADMINISTRACION$Semestre)
tabla_frecuencia.ADM
## Category f rf rf(%) cf cf(%)
## 1 83 0.17 16.70 83 16.70
## 5 66 0.13 13.28 149 29.98
## 7 65 0.13 13.08 214 43.06
## 3 62 0.12 12.47 276 55.53
## 8 49 0.10 9.86 325 65.39
## 9 46 0.09 9.26 371 74.65
## 2 37 0.07 7.44 408 82.09
## 6 31 0.06 6.24 439 88.33
## 4 27 0.05 5.43 466 93.76
## 10 15 0.03 3.02 481 96.78
## 11 12 0.02 2.41 493 99.20
## 12 4 0.01 0.80 497 100.00
BIOQUIMICA <- subset(alumnos, Carrera == "BIOQUIMICA")
# cATEGORIZAR AL SEMESTRE, No hay operaciones artiméticas con Semestre
BIOQUIMICA$Semestre <- factor(BIOQUIMICA$Semestre)
tabla_frecuencia.BIO <- fdt_cat(BIOQUIMICA$Semestre)
tabla_frecuencia.BIO
## Category f rf rf(%) cf cf(%)
## 1 84 0.19 19.05 84 19.05
## 3 65 0.15 14.74 149 33.79
## 7 55 0.12 12.47 204 46.26
## 5 47 0.11 10.66 251 56.92
## 4 40 0.09 9.07 291 65.99
## 9 38 0.09 8.62 329 74.60
## 6 36 0.08 8.16 365 82.77
## 2 34 0.08 7.71 399 90.48
## 8 17 0.04 3.85 416 94.33
## 11 11 0.02 2.49 427 96.83
## 10 10 0.02 2.27 437 99.09
## 12 3 0.01 0.68 440 99.77
## 13 1 0.00 0.23 441 100.00
MECATRONICA <- subset(alumnos, Carrera == "MECATRONICA")
# cATEGORIZAR AL SEMESTRE, No hay operaciones artiméticas con Semestre
MECATRONICA$Semestre <- factor(MECATRONICA$Semestre)
tabla_frecuencia.MCT <- fdt_cat(MECATRONICA$Semestre)
tabla_frecuencia.MCT
## Category f rf rf(%) cf cf(%)
## 1 70 0.16 16.20 70 16.20
## 5 64 0.15 14.81 134 31.02
## 3 61 0.14 14.12 195 45.14
## 7 56 0.13 12.96 251 58.10
## 4 45 0.10 10.42 296 68.52
## 8 32 0.07 7.41 328 75.93
## 9 28 0.06 6.48 356 82.41
## 2 26 0.06 6.02 382 88.43
## 6 23 0.05 5.32 405 93.75
## 10 16 0.04 3.70 421 97.45
## 11 8 0.02 1.85 429 99.31
## 12 3 0.01 0.69 432 100.00
MECANICA <- subset(alumnos, Carrera == "MECANICA")
# cATEGORIZAR AL SEMESTRE, No hay operaciones artiméticas con Semestre
MECANICA$Semestre <- factor(MECANICA$Semestre)
tabla_frecuencia.MCA <- fdt_cat(MECANICA$Semestre)
tabla_frecuencia.MCA
## Category f rf rf(%) cf cf(%)
## 1 76 0.25 25.25 76 25.25
## 3 58 0.19 19.27 134 44.52
## 5 43 0.14 14.29 177 58.80
## 7 41 0.14 13.62 218 72.43
## 6 21 0.07 6.98 239 79.40
## 9 18 0.06 5.98 257 85.38
## 8 14 0.05 4.65 271 90.03
## 11 14 0.05 4.65 285 94.68
## 10 11 0.04 3.65 296 98.34
## 12 3 0.01 1.00 299 99.34
## 4 2 0.01 0.66 301 100.00
ELECTRICA <- subset(alumnos, Carrera == "ELECTRICA")
# cATEGORIZAR AL SEMESTRE, No hay operaciones artiméticas con Semestre
ELECTRICA$Semestre <- factor(ELECTRICA$Semestre)
tabla_frecuencia.ELE <- fdt_cat(ELECTRICA$Semestre)
tabla_frecuencia.ELE
## Category f rf rf(%) cf cf(%)
## 1 77 0.28 27.50 77 27.50
## 5 54 0.19 19.29 131 46.79
## 3 42 0.15 15.00 173 61.79
## 7 27 0.10 9.64 200 71.43
## 9 21 0.07 7.50 221 78.93
## 11 15 0.05 5.36 236 84.29
## 6 12 0.04 4.29 248 88.57
## 10 12 0.04 4.29 260 92.86
## 12 8 0.03 2.86 268 95.71
## 8 6 0.02 2.14 274 97.86
## 15 3 0.01 1.07 277 98.93
## 2 1 0.00 0.36 278 99.29
## 13 1 0.00 0.36 279 99.64
## 14 1 0.00 0.36 280 100.00
ELECTRONICA <- subset(alumnos, Carrera == "ELECTRONICA")
# cATEGORIZAR AL SEMESTRE, No hay operaciones artiméticas con Semestre
ELECTRONICA$Semestre <- factor(ELECTRONICA$Semestre)
tabla_frecuencia.ELA <- fdt_cat(ELECTRONICA$Semestre)
tabla_frecuencia.ELA
## Category f rf rf(%) cf cf(%)
## 1 36 0.22 22.36 36 22.36
## 3 32 0.20 19.88 68 42.24
## 5 26 0.16 16.15 94 58.39
## 9 22 0.14 13.66 116 72.05
## 7 21 0.13 13.04 137 85.09
## 11 10 0.06 6.21 147 91.30
## 6 6 0.04 3.73 153 95.03
## 10 5 0.03 3.11 158 98.14
## 8 3 0.02 1.86 161 100.00
INFORMATICA <- subset(alumnos, Carrera == "INFORMATICA")
# cATEGORIZAR AL SEMESTRE, No hay operaciones artiméticas con Semestre
INFORMATICA$Semestre <- factor(INFORMATICA$Semestre)
tabla_frecuencia.INFO <- fdt_cat(INFORMATICA$Semestre)
tabla_frecuencia.INFO
## Category f rf rf(%) cf cf(%)
## 1 30 0.30 29.70 30 29.70
## 3 23 0.23 22.77 53 52.48
## 5 14 0.14 13.86 67 66.34
## 7 14 0.14 13.86 81 80.20
## 9 13 0.13 12.87 94 93.07
## 11 5 0.05 4.95 99 98.02
## 4 1 0.01 0.99 100 99.01
## 13 1 0.01 0.99 101 100.00
TIC <- subset(alumnos, Carrera == "TIC")
# cATEGORIZAR AL SEMESTRE, No hay operaciones artiméticas con Semestre
TIC$Semestre <- factor(TIC$Semestre)
tabla_frecuencia.TIC <- fdt_cat(TIC$Semestre)
tabla_frecuencia.TIC
## Category f rf rf(%) cf cf(%)
## 3 18 0.22 22.22 18 22.22
## 1 17 0.21 20.99 35 43.21
## 5 16 0.20 19.75 51 62.96
## 7 16 0.20 19.75 67 82.72
## 9 8 0.10 9.88 75 92.59
## 11 6 0.07 7.41 81 100.00
barplot(height = tabla_frecuencia.SIS$f,
names.arg = tabla_frecuencia.SIS$Category,
main = "Frecuencia de Alumnos SISTEMAS por Semestre")
barplot(height = tabla_frecuencia.IND$f,
names.arg = tabla_frecuencia.IND$Category,
main = "Frecuencia de Alumnos INDUSTRIAL por Semestre")
barplot(height = tabla_frecuencia.ARQ$f,
names.arg = tabla_frecuencia.ARQ$Category,
main = "Frecuencia de Alumnos ARQUITECTURA por Semestre")
barplot(height = tabla_frecuencia.CIV$f,
names.arg = tabla_frecuencia.CIV$Category,
main = "Frecuencia de Alumnos CIVIL por Semestre")
barplot(height = tabla_frecuencia.GES$f,
names.arg = tabla_frecuencia.GES$Category,
main = "Frecuencia de Alumnos GESTION EMPRESARIAL por Semestre")
barplot(height = tabla_frecuencia.QUI$f,
names.arg = tabla_frecuencia.QUI$Category,
main = "Frecuencia de Alumnos QUIMICA por Semestre")
barplot(height = tabla_frecuencia.ADM$f,
names.arg = tabla_frecuencia.ADM$Category,
main = "Frecuencia de Alumnos ADMINISTRACION por Semestre")
barplot(height = tabla_frecuencia.BIO$f,
names.arg = tabla_frecuencia.BIO$Category,
main = "Frecuencia de Alumnos BIOQUIMICA por Semestre")
barplot(height = tabla_frecuencia.MCT$f,
names.arg = tabla_frecuencia.MCT$Category,
main = "Frecuencia de Alumnos MECATRONICA por Semestre")
barplot(height = tabla_frecuencia.MCA$f,
names.arg = tabla_frecuencia.MCA$Category,
main = "Frecuencia de Alumnos MECANICA por Semestre")
barplot(height = tabla_frecuencia.ELE$f,
names.arg = tabla_frecuencia.ELE$Category,
main = "Frecuencia de Alumnos ELECTRICA por Semestre")
barplot(height = tabla_frecuencia.ELA$f,
names.arg = tabla_frecuencia.ELA$Category,
main = "Frecuencia de Alumnos ELECTRONICA por Semestre")
barplot(height = tabla_frecuencia.INFO$f,
names.arg = tabla_frecuencia.INFO$Category,
main = "Frecuencia de Alumnos INFORMATICA por Semestre")
barplot(height = tabla_frecuencia.TIC$f,
names.arg = tabla_frecuencia.TIC$Category,
main = "Frecuencia de Alumnos TICS por Semestre")
En este caso se muestran los registros de alumnos de las 14 carreras de cada semestre de una institución. El caso nos muestra la demanda que se tiene por cada carrera que existe y el número de alumnos por semestre mediante el uso de tablas de frecuencia y graficas de barras, para ello utilizamos la librería readr que nos permite cargar los datos csv mediante un enlace y la libreria fdth es quien nos permite crear las tablas de frecuencia y graficas de barras