Considering following vector res and matrix team. the vector res represent indices, and I require to extract only those names whose index number is in vector res and gender=
team <- structure(c("aa", "ab", "al", "alp", "amr", "and", "an", "anv",
"as", "ed", "neh", "pan", "poo", "ra", "roh", "shr", "sub", "val",
"xi", "M", "M", "M", "M", "F", "M", "M", "F", "M", "M", "F",
"M", "F", "M", "M", "F", "M", "M", "M"), .Dim = c(19L, 2L), .Dimnames = list(
NULL, c("names", "genders")))
team[,"names"][ intersect( which(team[,"genders"]=="F") , res ) ]
#[1] "amr" "shr"
team[,"names"][ team[,"genders"]=="F" & 1:NROW(team) %in% res ]
#[1] "amr" "shr"