Los datos
library(readr)
#datos <- read.csv("https://raw.githubusercontent.com/rpizarrog/probabilidad-y-estad-stica/master/practicas%20R/unidad%202/participantes%20en%20equipos%20deportivos.csv")
datos <- read.csv("https://raw.githubusercontent.com/rpizarrog/probabilidad-y-estad-stica/master/practicas%20R/unidad%202/alumnos.deportes.2020.csv")
datos
## X nombres sexo futbol basquetbol voleybol atletismo ajedrez tenis
## 1 1 Ana F FALSE FALSE FALSE FALSE FALSE FALSE
## 2 2 Antonio M FALSE FALSE FALSE FALSE FALSE FALSE
## 3 3 Aracely F FALSE FALSE FALSE FALSE FALSE TRUE
## 4 4 Carmen F FALSE TRUE FALSE FALSE FALSE FALSE
## 5 5 Eduardo M TRUE FALSE FALSE FALSE FALSE FALSE
## 6 6 Ernesto M FALSE TRUE FALSE FALSE FALSE FALSE
## 7 7 Gabino M FALSE TRUE FALSE FALSE FALSE FALSE
## 8 8 Gerardo M TRUE FALSE TRUE FALSE FALSE TRUE
## 9 9 Javier M FALSE TRUE FALSE FALSE FALSE FALSE
## 10 10 Jeorgina F FALSE TRUE FALSE FALSE FALSE FALSE
## 11 11 Juan M TRUE FALSE FALSE TRUE FALSE FALSE
## 12 12 Lalo M FALSE FALSE TRUE FALSE FALSE FALSE
## 13 13 Laura F FALSE TRUE FALSE FALSE FALSE FALSE
## 14 14 Lucy F TRUE FALSE TRUE TRUE FALSE FALSE
## 15 15 Luis M FALSE FALSE TRUE FALSE FALSE FALSE
## 16 16 Luisa F FALSE FALSE FALSE FALSE FALSE FALSE
## 17 17 Lupita F TRUE TRUE FALSE FALSE FALSE FALSE
## 18 18 Margarita F FALSE TRUE FALSE TRUE FALSE FALSE
## 19 19 Margarito M FALSE FALSE FALSE FALSE FALSE TRUE
## 20 20 Maria F FALSE TRUE FALSE FALSE FALSE FALSE
## 21 21 Memo M TRUE FALSE FALSE FALSE TRUE FALSE
## 22 22 Oscar M FALSE FALSE FALSE FALSE FALSE FALSE
## 23 23 Paco M TRUE FALSE TRUE FALSE TRUE FALSE
## 24 24 Patricia F TRUE FALSE FALSE TRUE FALSE FALSE
## 25 25 Paty F TRUE TRUE FALSE FALSE FALSE FALSE
## 26 26 Raul M TRUE FALSE FALSE FALSE FALSE FALSE
## 27 27 Romualdo M TRUE FALSE FALSE FALSE FALSE FALSE
## 28 28 Rosario F FALSE FALSE FALSE FALSE FALSE FALSE
## 29 29 Rubén M TRUE FALSE FALSE FALSE FALSE FALSE
## 30 30 Salvador M TRUE FALSE FALSE TRUE FALSE FALSE
## 31 31 Sandra F FALSE FALSE FALSE FALSE FALSE FALSE
## 32 32 Sandro M FALSE FALSE FALSE FALSE FALSE TRUE
## 33 33 Saul M TRUE FALSE TRUE FALSE FALSE FALSE
## 34 34 Yuri F TRUE FALSE FALSE FALSE FALSE FALSE
## 35 35 Arturo M FALSE FALSE FALSE FALSE FALSE FALSE
## 36 36 Angélica F TRUE TRUE TRUE FALSE FALSE FALSE
## 37 37 Arnulfo M FALSE FALSE TRUE FALSE FALSE FALSE
## 38 38 Bety F TRUE TRUE FALSE FALSE FALSE FALSE
## 39 39 Carlos M TRUE FALSE FALSE FALSE FALSE FALSE
## 40 40 Dagoberto M FALSE FALSE TRUE FALSE FALSE FALSE
## 41 41 Dany F TRUE TRUE FALSE FALSE FALSE FALSE
## 42 42 Dalia F TRUE FALSE FALSE FALSE FALSE FALSE
## 43 43 Efren M TRUE FALSE FALSE TRUE FALSE FALSE
## 44 44 Ernestina F TRUE FALSE TRUE FALSE TRUE FALSE
## 45 45 Fernando M TRUE FALSE FALSE TRUE FALSE FALSE
## 46 46 Fabián M FALSE TRUE TRUE FALSE FALSE FALSE
## 47 47 Fernanda F FALSE FALSE FALSE FALSE FALSE FALSE
## 48 48 Gabriela F FALSE FALSE FALSE FALSE FALSE FALSE
## 49 49 Gabriel M TRUE FALSE FALSE FALSE FALSE FALSE
## 50 50 Guille F TRUE FALSE FALSE FALSE TRUE FALSE
## 51 51 Jorge M TRUE TRUE FALSE FALSE FALSE FALSE
## 52 52 Lorenzo M TRUE FALSE TRUE FALSE FALSE FALSE
## 53 53 Mikaela F FALSE TRUE FALSE FALSE FALSE FALSE
## 54 54 Miguel M TRUE TRUE FALSE FALSE FALSE FALSE
## 55 55 Marcela F FALSE FALSE FALSE TRUE FALSE FALSE
## 56 56 Orlando M TRUE FALSE FALSE FALSE FALSE FALSE
## 57 57 Otilia F TRUE FALSE FALSE TRUE FALSE FALSE
## 58 58 Pedro M TRUE TRUE FALSE FALSE FALSE FALSE
## 59 59 Perla F FALSE FALSE FALSE FALSE FALSE FALSE
## 60 60 Raquel F TRUE TRUE FALSE FALSE FALSE FALSE
## 61 61 Susana F FALSE FALSE FALSE FALSE FALSE FALSE
## 62 62 Sandy F FALSE TRUE FALSE FALSE FALSE FALSE
## 63 63 Sotelo M FALSE FALSE TRUE TRUE FALSE FALSE
## 64 64 Tiburcio M FALSE FALSE FALSE TRUE FALSE FALSE
## 65 65 Teresa F FALSE FALSE FALSE FALSE FALSE FALSE
## 66 66 Walter F TRUE TRUE FALSE FALSE FALSE FALSE
## 67 67 Xóchitl F FALSE TRUE TRUE TRUE TRUE FALSE
n <- row(datos)
Conjunto Hombres y Mujeres
hombres <- subset(datos, sexo == 'M')
mujeres <- subset(datos, sexo == 'F')
hombres
## X nombres sexo futbol basquetbol voleybol atletismo ajedrez tenis
## 2 2 Antonio M FALSE FALSE FALSE FALSE FALSE FALSE
## 5 5 Eduardo M TRUE FALSE FALSE FALSE FALSE FALSE
## 6 6 Ernesto M FALSE TRUE FALSE FALSE FALSE FALSE
## 7 7 Gabino M FALSE TRUE FALSE FALSE FALSE FALSE
## 8 8 Gerardo M TRUE FALSE TRUE FALSE FALSE TRUE
## 9 9 Javier M FALSE TRUE FALSE FALSE FALSE FALSE
## 11 11 Juan M TRUE FALSE FALSE TRUE FALSE FALSE
## 12 12 Lalo M FALSE FALSE TRUE FALSE FALSE FALSE
## 15 15 Luis M FALSE FALSE TRUE FALSE FALSE FALSE
## 19 19 Margarito M FALSE FALSE FALSE FALSE FALSE TRUE
## 21 21 Memo M TRUE FALSE FALSE FALSE TRUE FALSE
## 22 22 Oscar M FALSE FALSE FALSE FALSE FALSE FALSE
## 23 23 Paco M TRUE FALSE TRUE FALSE TRUE FALSE
## 26 26 Raul M TRUE FALSE FALSE FALSE FALSE FALSE
## 27 27 Romualdo M TRUE FALSE FALSE FALSE FALSE FALSE
## 29 29 Rubén M TRUE FALSE FALSE FALSE FALSE FALSE
## 30 30 Salvador M TRUE FALSE FALSE TRUE FALSE FALSE
## 32 32 Sandro M FALSE FALSE FALSE FALSE FALSE TRUE
## 33 33 Saul M TRUE FALSE TRUE FALSE FALSE FALSE
## 35 35 Arturo M FALSE FALSE FALSE FALSE FALSE FALSE
## 37 37 Arnulfo M FALSE FALSE TRUE FALSE FALSE FALSE
## 39 39 Carlos M TRUE FALSE FALSE FALSE FALSE FALSE
## 40 40 Dagoberto M FALSE FALSE TRUE FALSE FALSE FALSE
## 43 43 Efren M TRUE FALSE FALSE TRUE FALSE FALSE
## 45 45 Fernando M TRUE FALSE FALSE TRUE FALSE FALSE
## 46 46 Fabián M FALSE TRUE TRUE FALSE FALSE FALSE
## 49 49 Gabriel M TRUE FALSE FALSE FALSE FALSE FALSE
## 51 51 Jorge M TRUE TRUE FALSE FALSE FALSE FALSE
## 52 52 Lorenzo M TRUE FALSE TRUE FALSE FALSE FALSE
## 54 54 Miguel M TRUE TRUE FALSE FALSE FALSE FALSE
## 56 56 Orlando M TRUE FALSE FALSE FALSE FALSE FALSE
## 58 58 Pedro M TRUE TRUE FALSE FALSE FALSE FALSE
## 63 63 Sotelo M FALSE FALSE TRUE TRUE FALSE FALSE
## 64 64 Tiburcio M FALSE FALSE FALSE TRUE FALSE FALSE
mujeres
## X nombres sexo futbol basquetbol voleybol atletismo ajedrez tenis
## 1 1 Ana F FALSE FALSE FALSE FALSE FALSE FALSE
## 3 3 Aracely F FALSE FALSE FALSE FALSE FALSE TRUE
## 4 4 Carmen F FALSE TRUE FALSE FALSE FALSE FALSE
## 10 10 Jeorgina F FALSE TRUE FALSE FALSE FALSE FALSE
## 13 13 Laura F FALSE TRUE FALSE FALSE FALSE FALSE
## 14 14 Lucy F TRUE FALSE TRUE TRUE FALSE FALSE
## 16 16 Luisa F FALSE FALSE FALSE FALSE FALSE FALSE
## 17 17 Lupita F TRUE TRUE FALSE FALSE FALSE FALSE
## 18 18 Margarita F FALSE TRUE FALSE TRUE FALSE FALSE
## 20 20 Maria F FALSE TRUE FALSE FALSE FALSE FALSE
## 24 24 Patricia F TRUE FALSE FALSE TRUE FALSE FALSE
## 25 25 Paty F TRUE TRUE FALSE FALSE FALSE FALSE
## 28 28 Rosario F FALSE FALSE FALSE FALSE FALSE FALSE
## 31 31 Sandra F FALSE FALSE FALSE FALSE FALSE FALSE
## 34 34 Yuri F TRUE FALSE FALSE FALSE FALSE FALSE
## 36 36 Angélica F TRUE TRUE TRUE FALSE FALSE FALSE
## 38 38 Bety F TRUE TRUE FALSE FALSE FALSE FALSE
## 41 41 Dany F TRUE TRUE FALSE FALSE FALSE FALSE
## 42 42 Dalia F TRUE FALSE FALSE FALSE FALSE FALSE
## 44 44 Ernestina F TRUE FALSE TRUE FALSE TRUE FALSE
## 47 47 Fernanda F FALSE FALSE FALSE FALSE FALSE FALSE
## 48 48 Gabriela F FALSE FALSE FALSE FALSE FALSE FALSE
## 50 50 Guille F TRUE FALSE FALSE FALSE TRUE FALSE
## 53 53 Mikaela F FALSE TRUE FALSE FALSE FALSE FALSE
## 55 55 Marcela F FALSE FALSE FALSE TRUE FALSE FALSE
## 57 57 Otilia F TRUE FALSE FALSE TRUE FALSE FALSE
## 59 59 Perla F FALSE FALSE FALSE FALSE FALSE FALSE
## 60 60 Raquel F TRUE TRUE FALSE FALSE FALSE FALSE
## 61 61 Susana F FALSE FALSE FALSE FALSE FALSE FALSE
## 62 62 Sandy F FALSE TRUE FALSE FALSE FALSE FALSE
## 65 65 Teresa F FALSE FALSE FALSE FALSE FALSE FALSE
## 66 66 Walter F TRUE TRUE FALSE FALSE FALSE FALSE
## 67 67 Xóchitl F FALSE TRUE TRUE TRUE TRUE FALSE
Frecuencias de Hombres y Mujeres
table(datos$sexo)
##
## F M
## 33 34
round(prop.table(table(datos$sexo)),4)
##
## F M
## 0.4925 0.5075
round(prop.table(table(datos$sexo)),4) * 100
##
## F M
## 49.25 50.75
Conjunto Futbol
futbol <- subset(datos, futbol == TRUE)
futbol
## X nombres sexo futbol basquetbol voleybol atletismo ajedrez tenis
## 5 5 Eduardo M TRUE FALSE FALSE FALSE FALSE FALSE
## 8 8 Gerardo M TRUE FALSE TRUE FALSE FALSE TRUE
## 11 11 Juan M TRUE FALSE FALSE TRUE FALSE FALSE
## 14 14 Lucy F TRUE FALSE TRUE TRUE FALSE FALSE
## 17 17 Lupita F TRUE TRUE FALSE FALSE FALSE FALSE
## 21 21 Memo M TRUE FALSE FALSE FALSE TRUE FALSE
## 23 23 Paco M TRUE FALSE TRUE FALSE TRUE FALSE
## 24 24 Patricia F TRUE FALSE FALSE TRUE FALSE FALSE
## 25 25 Paty F TRUE TRUE FALSE FALSE FALSE FALSE
## 26 26 Raul M TRUE FALSE FALSE FALSE FALSE FALSE
## 27 27 Romualdo M TRUE FALSE FALSE FALSE FALSE FALSE
## 29 29 Rubén M TRUE FALSE FALSE FALSE FALSE FALSE
## 30 30 Salvador M TRUE FALSE FALSE TRUE FALSE FALSE
## 33 33 Saul M TRUE FALSE TRUE FALSE FALSE FALSE
## 34 34 Yuri F TRUE FALSE FALSE FALSE FALSE FALSE
## 36 36 Angélica F TRUE TRUE TRUE FALSE FALSE FALSE
## 38 38 Bety F TRUE TRUE FALSE FALSE FALSE FALSE
## 39 39 Carlos M TRUE FALSE FALSE FALSE FALSE FALSE
## 41 41 Dany F TRUE TRUE FALSE FALSE FALSE FALSE
## 42 42 Dalia F TRUE FALSE FALSE FALSE FALSE FALSE
## 43 43 Efren M TRUE FALSE FALSE TRUE FALSE FALSE
## 44 44 Ernestina F TRUE FALSE TRUE FALSE TRUE FALSE
## 45 45 Fernando M TRUE FALSE FALSE TRUE FALSE FALSE
## 49 49 Gabriel M TRUE FALSE FALSE FALSE FALSE FALSE
## 50 50 Guille F TRUE FALSE FALSE FALSE TRUE FALSE
## 51 51 Jorge M TRUE TRUE FALSE FALSE FALSE FALSE
## 52 52 Lorenzo M TRUE FALSE TRUE FALSE FALSE FALSE
## 54 54 Miguel M TRUE TRUE FALSE FALSE FALSE FALSE
## 56 56 Orlando M TRUE FALSE FALSE FALSE FALSE FALSE
## 57 57 Otilia F TRUE FALSE FALSE TRUE FALSE FALSE
## 58 58 Pedro M TRUE TRUE FALSE FALSE FALSE FALSE
## 60 60 Raquel F TRUE TRUE FALSE FALSE FALSE FALSE
## 66 66 Walter F TRUE TRUE FALSE FALSE FALSE FALSE
Frecuencias de personas en Futbol
table(datos$futbol)
##
## FALSE TRUE
## 34 33
round(prop.table(table(datos$futbol)), 4)
##
## FALSE TRUE
## 0.5075 0.4925
round(prop.table(table(datos$futbol)), 4) * 100
##
## FALSE TRUE
## 50.75 49.25
Conjunto Basquetbol
basquetbol <- subset(datos, basquetbol == TRUE)
basquetbol
## X nombres sexo futbol basquetbol voleybol atletismo ajedrez tenis
## 4 4 Carmen F FALSE TRUE FALSE FALSE FALSE FALSE
## 6 6 Ernesto M FALSE TRUE FALSE FALSE FALSE FALSE
## 7 7 Gabino M FALSE TRUE FALSE FALSE FALSE FALSE
## 9 9 Javier M FALSE TRUE FALSE FALSE FALSE FALSE
## 10 10 Jeorgina F FALSE TRUE FALSE FALSE FALSE FALSE
## 13 13 Laura F FALSE TRUE FALSE FALSE FALSE FALSE
## 17 17 Lupita F TRUE TRUE FALSE FALSE FALSE FALSE
## 18 18 Margarita F FALSE TRUE FALSE TRUE FALSE FALSE
## 20 20 Maria F FALSE TRUE FALSE FALSE FALSE FALSE
## 25 25 Paty F TRUE TRUE FALSE FALSE FALSE FALSE
## 36 36 Angélica F TRUE TRUE TRUE FALSE FALSE FALSE
## 38 38 Bety F TRUE TRUE FALSE FALSE FALSE FALSE
## 41 41 Dany F TRUE TRUE FALSE FALSE FALSE FALSE
## 46 46 Fabián M FALSE TRUE TRUE FALSE FALSE FALSE
## 51 51 Jorge M TRUE TRUE FALSE FALSE FALSE FALSE
## 53 53 Mikaela F FALSE TRUE FALSE FALSE FALSE FALSE
## 54 54 Miguel M TRUE TRUE FALSE FALSE FALSE FALSE
## 58 58 Pedro M TRUE TRUE FALSE FALSE FALSE FALSE
## 60 60 Raquel F TRUE TRUE FALSE FALSE FALSE FALSE
## 62 62 Sandy F FALSE TRUE FALSE FALSE FALSE FALSE
## 66 66 Walter F TRUE TRUE FALSE FALSE FALSE FALSE
## 67 67 Xóchitl F FALSE TRUE TRUE TRUE TRUE FALSE
Frecuencias de personas en Basquetbol
table(datos$basquetbol)
##
## FALSE TRUE
## 45 22
round(prop.table(table(datos$basquetbol)), 4)
##
## FALSE TRUE
## 0.6716 0.3284
round(prop.table(table(datos$basquetbol)), 4) * 100
##
## FALSE TRUE
## 67.16 32.84
Conjunto Voleybol
voleybol <- subset(datos, voleybol == TRUE)
voleybol
## X nombres sexo futbol basquetbol voleybol atletismo ajedrez tenis
## 8 8 Gerardo M TRUE FALSE TRUE FALSE FALSE TRUE
## 12 12 Lalo M FALSE FALSE TRUE FALSE FALSE FALSE
## 14 14 Lucy F TRUE FALSE TRUE TRUE FALSE FALSE
## 15 15 Luis M FALSE FALSE TRUE FALSE FALSE FALSE
## 23 23 Paco M TRUE FALSE TRUE FALSE TRUE FALSE
## 33 33 Saul M TRUE FALSE TRUE FALSE FALSE FALSE
## 36 36 Angélica F TRUE TRUE TRUE FALSE FALSE FALSE
## 37 37 Arnulfo M FALSE FALSE TRUE FALSE FALSE FALSE
## 40 40 Dagoberto M FALSE FALSE TRUE FALSE FALSE FALSE
## 44 44 Ernestina F TRUE FALSE TRUE FALSE TRUE FALSE
## 46 46 Fabián M FALSE TRUE TRUE FALSE FALSE FALSE
## 52 52 Lorenzo M TRUE FALSE TRUE FALSE FALSE FALSE
## 63 63 Sotelo M FALSE FALSE TRUE TRUE FALSE FALSE
## 67 67 Xóchitl F FALSE TRUE TRUE TRUE TRUE FALSE
Frecuencias de personas en Voleybol
table(datos$voleybol)
##
## FALSE TRUE
## 53 14
round(prop.table(table(datos$voleybol)), 4)
##
## FALSE TRUE
## 0.791 0.209
round(prop.table(table(datos$voleybol)), 4) *100
##
## FALSE TRUE
## 79.1 20.9
Conjunto Atletismo
atletismo <- subset(datos, atletismo == TRUE)
atletismo
## X nombres sexo futbol basquetbol voleybol atletismo ajedrez tenis
## 11 11 Juan M TRUE FALSE FALSE TRUE FALSE FALSE
## 14 14 Lucy F TRUE FALSE TRUE TRUE FALSE FALSE
## 18 18 Margarita F FALSE TRUE FALSE TRUE FALSE FALSE
## 24 24 Patricia F TRUE FALSE FALSE TRUE FALSE FALSE
## 30 30 Salvador M TRUE FALSE FALSE TRUE FALSE FALSE
## 43 43 Efren M TRUE FALSE FALSE TRUE FALSE FALSE
## 45 45 Fernando M TRUE FALSE FALSE TRUE FALSE FALSE
## 55 55 Marcela F FALSE FALSE FALSE TRUE FALSE FALSE
## 57 57 Otilia F TRUE FALSE FALSE TRUE FALSE FALSE
## 63 63 Sotelo M FALSE FALSE TRUE TRUE FALSE FALSE
## 64 64 Tiburcio M FALSE FALSE FALSE TRUE FALSE FALSE
## 67 67 Xóchitl F FALSE TRUE TRUE TRUE TRUE FALSE
Frecuencias de personas en atletismo
table(datos$atletismo)
##
## FALSE TRUE
## 55 12
round(prop.table(table(datos$atletismo)), 4)
##
## FALSE TRUE
## 0.8209 0.1791
round(prop.table(table(datos$atletismo)), 4) * 100
##
## FALSE TRUE
## 82.09 17.91
Conjunto Ajedrez
ajedrez <- subset(datos, ajedrez == TRUE)
ajedrez
## X nombres sexo futbol basquetbol voleybol atletismo ajedrez tenis
## 21 21 Memo M TRUE FALSE FALSE FALSE TRUE FALSE
## 23 23 Paco M TRUE FALSE TRUE FALSE TRUE FALSE
## 44 44 Ernestina F TRUE FALSE TRUE FALSE TRUE FALSE
## 50 50 Guille F TRUE FALSE FALSE FALSE TRUE FALSE
## 67 67 Xóchitl F FALSE TRUE TRUE TRUE TRUE FALSE
Frecuencias de personas en ajedrez
table(datos$ajedrez)
##
## FALSE TRUE
## 62 5
round(prop.table(table(datos$ajedrez)), 4)
##
## FALSE TRUE
## 0.9254 0.0746
round(prop.table(table(datos$ajedrez)), 4) * 100
##
## FALSE TRUE
## 92.54 7.46
Conjunto Tenis
tenis <- subset(datos, tenis == TRUE)
tenis
## X nombres sexo futbol basquetbol voleybol atletismo ajedrez tenis
## 3 3 Aracely F FALSE FALSE FALSE FALSE FALSE TRUE
## 8 8 Gerardo M TRUE FALSE TRUE FALSE FALSE TRUE
## 19 19 Margarito M FALSE FALSE FALSE FALSE FALSE TRUE
## 32 32 Sandro M FALSE FALSE FALSE FALSE FALSE TRUE
Frecuencias de personas en tenis
table(datos$tenis)
##
## FALSE TRUE
## 63 4
round(prop.table(table(datos$tenis)), 4)
##
## FALSE TRUE
## 0.9403 0.0597
round(prop.table(table(datos$tenis)), 4) * 100
##
## FALSE TRUE
## 94.03 5.97
Union de conjuntos
Union de futbol y basquebol
futUbas <- union(futbol$nombres, basquetbol$nombres)
futUbas
## [1] "Eduardo" "Gerardo" "Juan" "Lucy" "Lupita" "Memo"
## [7] "Paco" "Patricia" "Paty" "Raul" "Romualdo" "Rubén"
## [13] "Salvador" "Saul" "Yuri" "Angélica" "Bety" "Carlos"
## [19] "Dany" "Dalia" "Efren" "Ernestina" "Fernando" "Gabriel"
## [25] "Guille" "Jorge" "Lorenzo" "Miguel" "Orlando" "Otilia"
## [31] "Pedro" "Raquel" "Walter" "Carmen" "Ernesto" "Gabino"
## [37] "Javier" "Jeorgina" "Laura" "Margarita" "Maria" "Fabián"
## [43] "Mikaela" "Sandy" "Xóchitl"
Probabilidad por frecuencia relativa de futbol y basquebol
cat("Hay ", length(futUbas), " alumnos que juegan fútbol o basquetbol de un total de ", max(n))
## Hay 45 alumnos que juegan fútbol o basquetbol de un total de 67
prob.futUbas <- length(futUbas) / max(n)
cat ("Probabilidad de que existan alumnos que jueguen futbol o basquetbol= ", prob.futUbas)
## Probabilidad de que existan alumnos que jueguen futbol o basquetbol= 0.6716418
Union de tenis y ajedrez
tenUaje <- union(tenis$nombres, ajedrez$nombres)
tenUaje
## [1] "Aracely" "Gerardo" "Margarito" "Sandro" "Memo" "Paco"
## [7] "Ernestina" "Guille" "Xóchitl"
Probabilidad por frecuencia relativa de tenis o ajedrez
cat("Hay ", length(tenUaje), " alumnos que juegan tenis o ajedrez de un total de ", max(n))
## Hay 9 alumnos que juegan tenis o ajedrez de un total de 67
prob.tenUaje <- length(tenUaje) / max(n)
cat("Probabilidad de que existan alumnos que jueguen tenis o ajedrez= ", prob.tenUaje)
## Probabilidad de que existan alumnos que jueguen tenis o ajedrez= 0.1343284
Union de atletismo o voleybol
atlUvol <- union(atletismo$nombres, voleybol$nombres)
atlUvol
## [1] "Juan" "Lucy" "Margarita" "Patricia" "Salvador" "Efren"
## [7] "Fernando" "Marcela" "Otilia" "Sotelo" "Tiburcio" "Xóchitl"
## [13] "Gerardo" "Lalo" "Luis" "Paco" "Saul" "Angélica"
## [19] "Arnulfo" "Dagoberto" "Ernestina" "Fabián" "Lorenzo"
Probabilidad por frecuencia relativa de atletismo o voleybol
cat("Hay ", length(atlUvol), " alumnos que juegan tenis o ajedrez de un total de ", max(n))
## Hay 23 alumnos que juegan tenis o ajedrez de un total de 67
prob.atlUvol <- length(atlUvol) / max(n)
cat("Probabilidad de que existan alumnos que jueguen tenis o ajedrez= ", prob.atlUvol)
## Probabilidad de que existan alumnos que jueguen tenis o ajedrez= 0.3432836
Union de voleybol o futbol
volUfut <- union(voleybol$nombres, futbol$nombres)
volUfut
## [1] "Gerardo" "Lalo" "Lucy" "Luis" "Paco" "Saul"
## [7] "Angélica" "Arnulfo" "Dagoberto" "Ernestina" "Fabián" "Lorenzo"
## [13] "Sotelo" "Xóchitl" "Eduardo" "Juan" "Lupita" "Memo"
## [19] "Patricia" "Paty" "Raul" "Romualdo" "Rubén" "Salvador"
## [25] "Yuri" "Bety" "Carlos" "Dany" "Dalia" "Efren"
## [31] "Fernando" "Gabriel" "Guille" "Jorge" "Miguel" "Orlando"
## [37] "Otilia" "Pedro" "Raquel" "Walter"
Probabilidad por frecuencia relativa de voleybol y futbol
cat("Hay ", length(volUfut), " alumnos que juegan tenis o ajedrez de un total de ", max(n))
## Hay 40 alumnos que juegan tenis o ajedrez de un total de 67
prob.volUfut <- length(volUfut) / max(n)
cat("Probabilidad de que existan alumnos que jueguen voleybol y futbol= ", prob.volUfut)
## Probabilidad de que existan alumnos que jueguen voleybol y futbol= 0.5970149
Union basquetbol o voleybol
basUvol <- union(basquetbol$nombres, voleybol$nombres)
basUvol
## [1] "Carmen" "Ernesto" "Gabino" "Javier" "Jeorgina" "Laura"
## [7] "Lupita" "Margarita" "Maria" "Paty" "Angélica" "Bety"
## [13] "Dany" "Fabián" "Jorge" "Mikaela" "Miguel" "Pedro"
## [19] "Raquel" "Sandy" "Walter" "Xóchitl" "Gerardo" "Lalo"
## [25] "Lucy" "Luis" "Paco" "Saul" "Arnulfo" "Dagoberto"
## [31] "Ernestina" "Lorenzo" "Sotelo"
Probabilidad por frecuencia relativa de basquetbol o voleybol
cat("Hay ", length(basUvol), " alumnos que juegan basquetbol o voleybol de un total de ", max(n))
## Hay 33 alumnos que juegan basquetbol o voleybol de un total de 67
prob.basUvol <- length(basUvol) / max(n)
cat("Probabilidad de que existan alumnos que jueguen basquetbol o voleybol= ", prob.basUvol)
## Probabilidad de que existan alumnos que jueguen basquetbol o voleybol= 0.4925373
Interseccion de Conjuntos
Interseccion de futbol y basquetbol
futIbas <- intersect(futbol$nombres, basquetbol$nombres)
futIbas
## [1] "Lupita" "Paty" "Angélica" "Bety" "Dany" "Jorge"
## [7] "Miguel" "Pedro" "Raquel" "Walter"
Probabilidad por frecuencia relativa de futbol y basquetbol
cat("Hay ", length(futIbas), " alumnos que juegan futbol y basquetbol de un total de ", max(n))
## Hay 10 alumnos que juegan futbol y basquetbol de un total de 67
prob.futIbas <- length(futIbas) / max(n)
cat("Alumnos que juegan futbol y basquetbol= ", prob.futIbas)
## Alumnos que juegan futbol y basquetbol= 0.1492537
Interseccion de tenis y ajedrez
tenIaje <- intersect(tenis$nombres, ajedrez$nombres)
tenIaje
## character(0)
Probabilidad por frecuencia relativa de tenis y ajedrez
cat("Hay ", length(tenIaje), " alumnos que juegan tenis y ajedrez de un total de ", max(n))
## Hay 0 alumnos que juegan tenis y ajedrez de un total de 67
prob.tenIaje <- length(tenIaje) / max(n)
cat("Alumnos que juegan tenis y ajedrez= ", prob.tenIaje)
## Alumnos que juegan tenis y ajedrez= 0
Interseccion de atletismo y voleybol
atlIvol <- intersect(atletismo$nombres, voleybol$nombres)
atlIvol
## [1] "Lucy" "Sotelo" "Xóchitl"
Probabilidad por frecuencia relativa de atletismo y voleybol
cat("Hay ", length(atlIvol), " alumnos que juegan tenis y ajedrez de un total de ", max(n))
## Hay 3 alumnos que juegan tenis y ajedrez de un total de 67
prob.atlIvol <- length(atlIvol) / max(n)
cat("Alumnos que juegan tenis y ajedrez= ", prob.atlIvol)
## Alumnos que juegan tenis y ajedrez= 0.04477612
Interseccion de voleybol y futbol
volIfut <- intersect(voleybol$nombres, futbol$nombres)
volIfut
## [1] "Gerardo" "Lucy" "Paco" "Saul" "Angélica" "Ernestina"
## [7] "Lorenzo"
Probabilidad por frecuencia relativa de voleybol y futbol
cat("Hay ", length(volIfut), " alumnos que juegan tenis y ajedrez de un total de ", max(n))
## Hay 7 alumnos que juegan tenis y ajedrez de un total de 67
prob.volIfut <- length(volIfut) / max(n)
cat("Alumnos que juegan tenis y ajedrez= ", prob.volIfut)
## Alumnos que juegan tenis y ajedrez= 0.1044776
Interseccion de basquetbol y voleybol
basIvol <- intersect(basquetbol$nombres, voleybol$nombres)
basIvol
## [1] "Angélica" "Fabián" "Xóchitl"
Probabilidad por frecuencia relativa de basquetbol y voleybol
cat("Hay ", length(basIvol), " alumnos que juegan tenis y ajedrez de un total de ", max(n))
## Hay 3 alumnos que juegan tenis y ajedrez de un total de 67
prob.basIvol <- length(basIvol) / max(n)
cat("Alumnos que juegan tenis y ajedrez= ", prob.basIvol)
## Alumnos que juegan tenis y ajedrez= 0.04477612