title: Cloud Comparison for text represented in graph (wordCloud package)
body: <p>I have a query-related content set (from emails) that are being reprocessed using the <code>tm</code> package.  Wanting to represent it graphically, I came across <a href="https://sites.google.com/site/miningtwitter/questions/talking-about/wordclouds/comparison-cloud" rel="nofollow noreferrer">this twitter cloud comparison on text</a> and am trying to load and represent my data like it does. I have more than 500 lists of corpus data. When converted to a <code>DocumentTermMatrix</code> it gives all words in the lists which amounts to more than 3k words.  </p>
  
  <p><strong>data: (corpus) - b</strong></p>
  
  <pre><code>[[538]]
  &lt;&lt;PlainTextDocument (metadata: 7)&gt;&gt;
    kumar m santhosh   monday  october   pm  rizal herwin g s venkatesh global business reporting cc tjhin minarti arsojo nindyo subje
  
  [[539]]
  &lt;&lt;PlainTextDocument (metadata: 7)&gt;&gt;
    harjono bambang  wednesday  october   pm  global business reporting cc saptadi firman subject re commercial asia booking point limits  
  
  [[540]]
  &lt;&lt;PlainTextDocument (metadata: 7)&gt;&gt;
    kumar m santhosh   tuesday  october     global business reporting ramesh sandeep talanki   g s venkatesh cc challagundla ram bhupal chowdary subject fw please approve  qlikview gpa access please action  access request regards santhosh   monteleone elif  monday  october     g s venkatesh kumar m santhosh  cc singh sarvjeet saini subject fw please approve  qlikview gpa access hi guys can  please get access    finiasi jieni  monday  october     monteleone elif subject fw please approve  qlikview gpa access hi elif hope   well    able  approve  request  access   pacific sites please regards jieni   finiasi jieni  monday  september     deo ravinesh subject please approve  qlikview gpa access hello can  please review  attached form  click line manager approval  approve 
  
  [[541]]
  &lt;&lt;PlainTextDocument (metadata: 7)&gt;&gt;
  roe clarification
  
  [[542]]
  &lt;&lt;PlainTextDocument (metadata: 7)&gt;&gt;
    heo jae hyun  wednesday  october     icis helpdesk subject case id  fw questions  gpa hi team  response   inquiry   jae hyun heo  director  financial institutions group nd floor kyobo building  chongro  ka chongro ku seoul korea office      mobile      email jaehyunheoanzcom australia  new zealand banking group ltd     heo jae hyun  monday  september     icis helpdesk subject questions  gpa hi team please see  screen copy  gpa  fig korea   like  ask  following questions   terms  revrwa  calculation   key performance ratio  revrwa mtd  gpa  however   calculated  ratio based upon  information  gpa  shows total revenue mtd  rwa mtd   mn  mn    question      gpa  calculated revrwa ytd  gpa  however   calculated  ratio based upon  informaiton  gpa  shows  total revenue ytd  rwa ytd   mn  mn    question      gpa  calculated revrwa fyx  gpa    calculated  ratio based upon  information  gpa  shows  total revenue fyx  rwa fyx   mn  mn      almost     gpa  can  find revrwa ratio   client level  jae hyun heo  director  financial institutions group nd floor kyobo building  chongro  ka chongro ku seoul korea office      mobile      email jaehyunheoanzcom australia  new zealand banking group ltd 
  </code></pre>
  
  <p><strong>data$output:</strong></p>
  
  <pre><code>Report/Data
  Access
  Access
  Access
  Report/Data
  </code></pre>
  
  <p><strong>code:</strong></p>
  
  <pre><code>tdm &lt;- TermDocumentMatrix(b)
  matrix &lt;- as.matrix(tdm)
  colnames(term.matrix) =c(data$Output)
  #for each list in data corresponding output is must be attcahed 
  #here output-("Access","Report/Data") is represented as 1 and 2
  
  
   comparison.cloud(term.matrix,max.words=2000,random.order=FALSE)
      commonality.cloud(term.matrix,random.order=FALSE)
  #error Error in strwidth(words[i], cex = size[i], ...) : invalid 'cex' value
  </code></pre>
  
  <p>The output from <code>comparison.cloud</code> is below<img src="https://i.stack.imgur.com/OlThY.jpg" alt="enter image description here"> 
   <strong><em>how can I replace the number 1 and 2 with the original content and represent effectively the text in the graph?</em></strong></p>