I want to count the frequency of certain terms in a window of every 10 words in a vector of single words:
An example is
mywords<-sample(c("POS","NNTD","DD","HG","KKL"),10000 replace = TRUE)
mywords<-data.frame(mywords)
names(mywords)<-c("TheTerms")
I want to get the frequency of each term every 10 terms. I imagine this can be done in dplyr
mywords%>%group_by(TheTerms)%>%summarise(n=n())
but how do I get this done very 10 words?