title: R: How can I add titles based on grouping variable in word_associate?
body: <p>I am using the <a href="https://rdrr.io/cran/qdap/man/word_associate.html" rel="nofollow noreferrer">word_associate package</a> in R Markdown to create word clouds across a grouping variable with multiple categories. I would like the titles of each word cloud to be drawn from the character values of the grouping variable.</p>
  <p>I have added trans_cloud(title=TRUE) to my code, but have not been able to resolve my problem. Here's my code, which runs but doesn't produce graphs with titles:</p>
  <pre><code>library(qdap)
  word_associate(df$text, match.string=c(&quot;cat&quot;), grouping.var=c(df$id), 
                 text.unit=&quot;sentence&quot;, stopwords=c(Top200Words), wordcloud=TRUE, cloud.colors=c(&quot;#0000ff&quot;,&quot;#FF0000&quot;), 
                 trans_cloud(title=TRUE)) 
  </code></pre>
  <p>I have also tried the following, which does not run:</p>
  <pre><code>library(qdap)
  word_associate(df$text, match.string=c(&quot;cat&quot;), grouping.var=c(df$id), 
  text.unit=&quot;sentence&quot;, stopwords=c(Top200Words), wordcloud=TRUE, cloud.colors=c(&quot;#0000ff&quot;,&quot;#FF0000&quot;), 
  title=TRUE) 
  </code></pre>
  <p>Can anyone help me figure this out? I can't find any guidance in the documentation and there's hardly any examples of or discussions about word_associate on the web.</p>
  <p>Here's an example data frame that reproduces the problem:</p>
  <pre><code>id          text
  question1   I love cats even though I'm allergic to them.
  question1   I hate cats because I'm allergic to them.
  question1   Cats are funny, cute, and sweet.
  question1   Cats are mean and they scratch me.     
  question2   I only pet cats when I have my epipen nearby.
  question2   I avoid petting cats at all cost.
  question2   I visit a cat cafe every week. They have 100 cats.
  question2   I tried to pet my friend's cat and it attacked me.
  </code></pre>
  <p>Note that if I run this in R (instead of Markdown), the figures automatically print the &quot;question1_list1&quot; and &quot;question2_list1&quot; in bright blue at the top of the figure file. This doesn't work for me because I need the titles to exclude &quot;_list1&quot; and be written in black. These automatically generated titles do not respond to changes in my trans_cloud specifications.
  Ex:</p>
  <pre><code>library(qdap)
  word_associate(df$text, match.string=c(&quot;cat&quot;), grouping.var=c(df$id), 
                 text.unit=&quot;sentence&quot;, stopwords=c(Top200Words), wordcloud=TRUE, cloud.colors=c(&quot;#0000ff&quot;,&quot;#FF0000&quot;), 
                 trans_cloud(title=TRUE, title.color=&quot;#000000&quot;)) 
  </code></pre>
  <p>In addition, I'm locked in to using this package (as opposed to other options for creating word clouds in R) because I'm using it to create network plots, too.</p>