[1] 9162933
$of
[1] 11 21 42 56
$output
[1] 12 19 39 57
Yep, ordered from least to most frequent.
We can also do a plot of the most frequent words. I ran the following
code on an article on R in theNew York Times, “Data Analysts Captivated by
R’s Power,” from January 6, 2009.
> nyt <- findwords("nyt.txt")
Read 1011 items
> snyt <- freqwl(nyt)
> nwords <- length(ssnyt)
> barplot(ssnyt[round(0.9*nwords):nwords])
My goal was to plot the frequencies of the top 10 percent of the words in
the article. The results are shown in Figure 4-1.
Figure 4-1: Top word frequencies in an article about R
98 Chapter 4