What are the names of the female pirates who like superman. Why is "Babice" included in the answer when she doesn't like superman (but rather Antman)?
piratesurvey2 <- data.frame(
name = c("Astrid", "Lea", "Sarina", "Remon", "Letizia", "Babice", "Jonas", "Wendy", "Niveditha", "Gioia"),
sex = c("F", "F", "F", "M", "F", "F", "M", "F", "F", "F"),
superhero = c("Batman", "Superman", "Batman", "Spiderman", "Batman",
"Antman", "Batman", "Superman", "Maggott", "Superman"),
stringsAsFactors = FALSE)
> piratesurvey2$name[(piratesurvey$superhero == "Superman")[piratesurvey$sex == "F"]]
[1] "Lea" "Babice" "Wendy" "Gioia"
> (piratesurvey$superhero == "Superman")[piratesurvey$sex == "F"]
[1] FALSE TRUE FALSE FALSE FALSE TRUE FALSE TRUE