문제

I have the following data as an example:

 basketball = c("MISS W. Johnson 18' Pullup Jump Shot",
                "MISS Barnes 12' Pullup Jump Shot",
                "MISS Carter  19' Pullup Jump Shot")

How do I find the most common words or 'intersect' them so that I will only have "MISS Pullup Jump Shot" as the result?

도움이 되었습니까?

해결책

This works, but I'm not sure how robust it is given your question is a little vague.

Reduce(intersect, strsplit(basketball," "))
#[1] "MISS"   "Pullup" "Jump"   "Shot"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top