title: Classifying new text using LDA in R
body: <p>I am trying out topic modeling using R for the first time. So, this might be a very dumb question but I am stuck and googling has not given a definitive answer. </p>
  
  <p>Given a corpus of documents, I used the LDA function to identify the different topics in the corpus. Once, the model has been fitted, how can I apply the model on a new batch of documents to classify them among the topics discovered so far?</p>
  
  <p>example code:</p>
  
  <pre><code>data("AssociatedPress", package = "topicmodels")
  
  n &lt;- nrow(AssociatedPress)
  train_data &lt;- sample(1:n,0.75*n,replace = FALSE)
  AssociatedPress_train &lt;- AssociatedPress[(train_data),]
  AssociatedPress_test &lt;- AssociatedPress[!(train_data),]
  
  ap_lda &lt;- LDA(AssociatedPress_train, k = 5, control = list(seed = 1234))
  </code></pre>
  
  <p>Now, can I classify the documents in AssociatedPress_test using the fitted model ap_lda? If yes, how? If not, what would be the best way to create a model for such future classification? </p>