June 2017
Beginner to intermediate
576 pages
15h 22m
English
The tm package has a useful function called findFreqTerms, which is useful to find the frequency of the popular terms used. The second argument to the function restricts the results to terms that have a minimum frequency specified. We can also compute the occurrences by summing up the 1s and 0s for each term in the TDM. Then we can sort the list and display the highest and lowest frequency occurrences:
data.frame(findFreqTerms(dtms, 10000, Inf)) > findFreqTerms.dtms..10000..Inf. > 1 cake > 2 christmas > 3 design > 4 heart > 5 metal > 6 retrospot > 7 vintage freq <- colSums(as.matrix(dtms)) # there are xx terms length(freq) > [1] 62 ord <- order(freq) # look at the top and bottom number of terms freq[head(ord, 12)] ...