title: R LDAvis defining documents for each topic
body: <p>This is a question about LDA and the application LDAvis in R. As this is my first time using this package I would appreciate any help that could help my research.</p>
  
  <p>I want to be able to view the documents that have been defined by each topic based on probability. I am using survey data and I am looking at the comment section and have defined each of them as documents. </p>
  
  <p>I am going to use the example "A topic model for movie reviews" by cpsievert, as this is very similar to my code. The full code can be found in the following link: Visit</p>
  
  <p><a href="http://cpsievert.github.io/LDAvis/reviews/reviews.html" rel="nofollow">http://cpsievert.github.io/LDAvis/reviews/reviews.html</a></p>
  
  <p>I have got to the stage of fitting the model using the LDA model based on the following code:</p>
  
  <pre><code>set.seed(123)
  fit &lt;- lda.collapsed.gibbs.sampler(documents = documents, K = K, vocab = vocab, 
                                 num.iterations = G, alpha = alpha, 
                                 eta = eta, initial = NULL, burnin = 0,
                                 compute.log.likelihood = TRUE)
  </code></pre>
  
  <p>And then used the LDAvis to create the interactive html, with the following code:</p>
  
  <pre><code>json &lt;- createJSON(phi = MovieReviews$phi, 
                 theta = MovieReviews$theta, 
                 doc.length = MovieReviews$doc.length, 
                 vocab = MovieReviews$vocab, 
                 term.frequency = MovieReviews$term.frequency)
  </code></pre>
  
  <p>Now based on the interactive html I have defined the topic based on the frequency terms. There is an example of this on Movie Reviews, which can be found with following link:</p>
  
  <p><a href="http://cpsievert.github.io/LDAvis/reviews/vis/#topic=7&amp;lambda=0.6&amp;term=" rel="nofollow">http://cpsievert.github.io/LDAvis/reviews/vis/#topic=7&amp;lambda=0.6&amp;term=</a></p>
  
  <p>This topic can be defined as comedies for Movie Reviews. </p>
  
  <p>So if in this example "topic7" is known as comedies, how can you view the reviews, which are most probable to be defined by this topic?</p>
  
  <p>I would like to know, how would I define documents based on topic7 and then be able to view them, say using:</p>
  
  <pre><code>View(MovieReviwes$Topic7)
  </code></pre>
  
  <p>I apologise if this question is broad and long, but if someone could answer it by using the example I have given in the link, this would help greatly. Thanks in advance.</p>