regex - R intersecting strings -
this question has answer here:
i have following data example:
basketball = c("miss w. johnson 18' pullup jump shot", "miss barnes 12' pullup jump shot", "miss carter 19' pullup jump shot") how find common words or 'intersect' them have "miss pullup jump shot" result?
this works, i'm not sure how robust given question little vague.
reduce(intersect, strsplit(basketball," ")) #[1] "miss" "pullup" "jump" "shot"
Comments
Post a Comment