PRÁCTICA CALIFICADA 1 - ESTADÍSTICA

MILLA LOSTAUNAU, BRAYAN - 18020469

Práctica de Data Frame

nombre=c("Juan","Rocio","Manuel","Pedro","Carla", "Fresia","Alfredo","Teresa","Maria")
colegio=c("Guadalupe","Pitagoras","Cruz Saco","Carmelitas","Cruz Saco","Carmelitas","Guadalupe","Cruz Saco","Cruz Saco")
edad=c(22, 20, 19, 22, 21, 18, 24, 21, 23)
fueradeLima=c("SI", "NO", "SI", "NO",  "NO",  "SI", "NO", "NO",  "NO")
sexo=c("M","F", "M", "M", "F", "F", "M", "F", "F")
universidad=c("UNMSM" ,"UNFV",  "UNI",  "UNI",  "UNI" , "UNFV", "UNMSM", "UNMSM","UNMSM") 
estad=data.frame(nombre,colegio,edad,fueradeLima,sexo,universidad,stringsAsFactors = F)
  1. Edad del más joven (hombre o mujer) no limeño.
estad[estad$edad==min(estad$edad) & estad$fueradeLima=='SI',c('edad')]
## [1] 18
  1. Sexo del mas joven que esté en San Marcos y que estudió en el Guadalupe.
estad[estad$universidad=="UNMSM" & estad$colegio=="Guadalupe" & estad$edad==min(estad$edad[estad$universidad=="UNMSM" & estad$colegio=="Guadalupe"]),"sexo"]
## [1] "M"

Nombre del hombre limeño que tenga menos de 21 años.

estad[estad$sexo=="M" & estad$fueradeLima=="NO" & estad$edad<21,"nombre"]
## character(0)