title: R - Incorporating a precoded training set into lda model
body: <p>I am attempting to assign a list of surveyed questions into 30 different categories using the LDA function in the topicmodels package.</p>
  
  <p>The code I have so far is:</p>
  
  <pre><code>source &lt;- VectorSource(openended$q2)
  corpus &lt;- Corpus(source)
  
  corpus &lt;- tm_map(corpus, content_transformer(tolower))
  corpus &lt;- tm_map(corpus, removeNumbers)
  corpus &lt;- tm_map(corpus, removePunctuation)
  corpus &lt;- tm_map(corpus, stripWhitespace)
  corpus &lt;- tm_map(corpus, removeWords, stopwords('english'))
  corpus &lt;- tm_map(corpus, stemDocument, language = "english")
  
  mat &lt;- DocumentTermMatrix(corpus)
  rowTotals &lt;- apply(mat , 1, sum) 
  mat &lt;- mat[rowTotals&gt; 0, ]
  
  burnin &lt;- 4000
  iter &lt;- 2000
  thin &lt;- 500
  seed &lt;-list(2003,5,63,100001,765)
  nstart &lt;- 5
  best &lt;- TRUE
  
  k &lt;- 30
  
  ldaOut &lt;-LDA(mat,k, method="Gibbs", control=list(nstart=nstart, seed = seed, 
  best=best, burnin = burnin, iter = iter, thin=thin))
  ldaOut.topics &lt;- as.matrix(topics(ldaOut))
  write.csv(ldaOut.topics,file=paste("LDAGibbs",k,"DocsToTopics.csv"))
  </code></pre>
  
  <p>I already have 10% of the data in openended$q2 appropriately coded, how can I train the algorithm using that data?</p>
  
  <p>Thanks!</p>