title: Creating "word" cloud of phrases, not individual words in R
body: <p>I am trying to make a word cloud from a list of phrases, many of which are repeated, instead of from individual words. My data looks something like this, with one column of my data frame being a list of phrases.</p>
  
  <pre><code>df$names &lt;- c("John", "John", "Joseph A", "Mary A", "Mary A", "Paul H C", "Paul H C")
  </code></pre>
  
  <p>I would like to make a word cloud where all of these names are treated as individual phrases whose frequency is displayed, not the words which make them up. The code I have been using looks like:</p>
  
  <pre><code>df.corpus &lt;- Corpus(DataframeSource(data.frame(df$names)))
  df.corpus &lt;- tm_map(client.corpus, function(x) removeWords(x, stopwords("english")))
  #turning that corpus into a tDM
  tdm &lt;- TermDocumentMatrix(df.corpus)
  m &lt;- as.matrix(tdm)
  v &lt;- sort(rowSums(m),decreasing=TRUE)
  d &lt;- data.frame(word = names(v),freq=v)
  pal &lt;- brewer.pal(9, "BuGn")
  pal &lt;- pal[-(1:2)]
  #making a worcloud
  png("wordcloud.png", width=1280,height=800)
  wordcloud(d$word,d$freq, scale=c(8,.3),min.freq=2,max.words=100, random.order=T, rot.per=.15, colors="black", vfont=c("sans serif","plain"))
  dev.off()
  </code></pre>
  
  <p>This creates a word cloud, but it is of each component word, not of the phrases. So, I see the relative frequency of "A". "H", "John" etc instead of the relative frequency of "Joseph A", "Mary A", etc, which is what I want.</p>
  
  <p>I'm sure this isn't that complicated to fix, but I can't figure it out! I would appreciate any help.</p>