I hope you are doing good.
Topwords.csv that was generated consists of the words and their frequency. We need one more column that represents the cluster that particular word belongs to.
sunday 148 1
cowboys 105 1
night 103 1
game 85 1
redskins 84 1
@dallascowboys 51 2
@redskins 36 2
@sportscenter 36 2
the 22 2
romo 12 2
To achieve you can use a simply for loop that goes through each cluster and finding the top 5 words for each cluster as shown below:
for( i in 1:10)
tdm <- TermDocumentMatrix(y)
v<- sort(rowSums(m), decreasing = TRUE)
Try to generate the topwords.csv in this pattern and check.
Hope this helps you.
Please feel free to revert if you need any further help.
If you feel satisfied with my response kindly leave your feedback by clicking on any one of the below smileys
Please note if you are not happy with the response on this ticket, please escalate it to firstname.lastname@example.org.
We assure you that we will get back to you within 24 hours