install.packages("tm")
install.packages("wordcloud")
install.packages("RColorBrewer")
library(tm)
## Loading required package: NLP
library(wordcloud)
## Loading required package: RColorBrewer
library(RColorBrewer)
data(crude)
crude <- tm_map(crude, removePunctuation)
crude <- tm_map(crude, function(x)removeWords(x,stopwords()))
from corpus
wordcloud(crude)

from frequency counts
tdm <- TermDocumentMatrix(crude)
m <- as.matrix(tdm)
v <- sort(rowSums(m),decreasing=TRUE)
d <- data.frame(word = names(v),freq=v)
wordcloud(d$word,d$freq)

A bigger cloud with a minimum frequency of 2

wordcloud(d$word,d$freq,c(8,.3),2)
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): prices could not be fit
## on page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): said could not be fit
## on page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): opec could not be fit
## on page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): mln could not be fit on
## page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): imports could not be
## fit on page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): agriculture could not
## be fit on page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): increasing could not be
## fit on page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): producer could not be
## fit on page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): nymex could not be fit
## on page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): government could not be
## fit on page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): along could not be fit
## on page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): circumstance could not
## be fit on page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): effective could not be
## fit on page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): they could not be fit
## on page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): several could not be
## fit on page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): 198788 could not be fit
## on page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): hisham could not be fit
## on page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): mizrahi could not be
## fit on page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): canada could not be fit
## on page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): revenue could not be
## fit on page. It will not be plotted.
## Warning in wordcloud(d$word, d$freq, c(8, 0.3), 2): techniques could not be
## fit on page. It will not be plotted.