title: How to get the corresponding Tweets that generate the LDA topics?
body: <p>I face the following issue. I extracted Tweets and have now a collection of about 500 tweets in one csv file. With these I would like to generate topics using the LDA model. So far so good. I do receive the topics but now I would like to know which Tweets belong to which topics. But I just don't know how to do that...
  I have a csv file where I numbered each Tweet. I thought this way I could get the corresponding Tweets which built a topic, but the command "topics(lda)" doesn't work. Maybe someone out there can help me, please^^</p>
  
  <p><a href="http://i.stack.imgur.com/Xgv65.jpg" rel="nofollow">This is the csv file I use (LDA_start). Only two columns (number, text)</a></p>
  
  <p>And this is the code I use which I found in a tutorial for LDA modelling (I'm a R beginner)</p>
  
  <pre><code>library("SocialMediaLab")
  library("topicmodels")
  library("slam")
  library("Rmpfr")
  library("tm")
  library("stringr")
  
  myData = read.csv("LDA_start.csv", header = TRUE)
  
  tweetCorpus &lt;- VCorpus(VectorSource(myData))
  
  myStopwords &lt;- c(stopwords('english'))
  tweetCorpus &lt;- tm_map(tweetCorpus, removeWords, myStopwords)
  
  dtmTopicModeling &lt;- DocumentTermMatrix(tweetCorpus,control = list(stemming = TRUE, tolower = TRUE, removeNumbers = TRUE, removePunctuation = TRUE, wordLengths = c(3, 30)))
  
  harmonicMean &lt;- function(logLikelihoods, precision=2000L) {
  llMed &lt;- median(logLikelihoods)
  as.double(llMed - log(mean(exp(-mpfr(logLikelihoods,
  prec = precision) + llMed))))
  }
  
  burnin = 1000
  iter = 1000
  keep = 50
  
  sequ &lt;- seq(2, 100, 5)
  fitted_many &lt;- lapply(sequ, function(k) LDA(dtmTopicModeling, k = k, method = "Gibbs",control = list(burnin = burnin, iter = iter, keep = keep) ))
  
  logLiks_many &lt;- lapply(fitted_many, function(L) L@logLiks[-c(1:(burnin/keep))])
  
  hm_many &lt;- sapply(logLiks_many, function(h) harmonicMean(h))
  
  k &lt;- sequ[which.max(hm_many)]
  
  seedNum &lt;- 42
  
  lda &lt;- LDA(dtmTopicModeling, k = k, method = "Gibbs", control = list(burnin = burnin, iter = iter, keep = keep, seed=seedNum))
  
  write.csv(terms(lda,50), "TopicModel.csv")
  topics(lda)
  1 
  1 
  </code></pre>
  
  <p>Is there maybe an easier way to generate topics and find the Tweets which made them than mine? I would be really grateful for answers!</p>