in reply to difference between grep and map
Excellent advice on this is given in the classic Shiny Ball Book, Item 12 "Use foreach, map and grep as appropriate":