title: tf-idf document term matrix and LDA: Error messages in R
body: <p>Can we input tf-idf document term matrix into Latent Dirichlet Allocation (LDA)? if yes, how?</p>
  
  <p>It does not work in my case and the LDA function requires the 'term-frequency' document term matrix.</p>
  
  <p>Thank you</p>
  
  <p>(I make a question as concise as possible. So, if you need more details, I can add </p>
  
  <pre><code>##########################################################################
                             TF-IDF Document matrix construction
  ##########################################################################    
  
  &gt; DTM_tfidf &lt;-DocumentTermMatrix(corpora,control = list(weighting = 
  function(x)+   weightTfIdf(x, normalize = FALSE)))
  &gt; str(DTM_tfidf)
  List of 6
  $ i       : int [1:4466] 1 1 1 1 1 1 1 1 1 1 ...
  $ j       : int [1:4466] 6 10 22 26 28 36 39 41 47 48 ...
  $ v       : num [1:4466] 6 2.09 1.05 3.19 2.19 ...
  $ nrow    : int 64
  $ ncol    : int 297
  $ dimnames:List of 2
    ..$ Docs : chr [1:64] "1" "2" "3" "4" ...
    ..$ Terms: chr [1:297] "accommod" "account" "achiev" "act" ...
  - attr(*, "class")= chr [1:2] "DocumentTermMatrix" "simple_triplet_matrix"
  - attr(*, "weighting")= chr [1:2] "term frequency - inverse document 
  frequency" "tf-idf"
  
  ##########################################################################
                             LDA section
  ##########################################################################
  
  &gt; LDA_results &lt;-LDA(DTM_tfidf,k, method="Gibbs", control=list(nstart=nstart,
    +                                seed = seed, best=best, 
    +                                burnin = burnin, iter = iter, thin=thin))
  
  ##########################################################################
                             Error messages
  ##########################################################################
    Error in LDA(DTM_tfidf, k, method = "Gibbs", control = list(nstart = 
    nstart,  : 
    The DocumentTermMatrix needs to have a term frequency weighting
  </code></pre>