'Convert processed format with stm into dtm (Structural topic modeling)

I have used the textProcessor and the prepDocuments functions from the stm package to clean a corpus. Now I would like to convert the resulting object (list of indices plus vocabulary) into a standard document-term matrix (or quanteda document-feature matrix) so that I can apply topicmodels function LDA and compare the resulting topics with stm.

processed <- textProcessor(poliblog5k.docs,
                           metadata = poliblog5k.meta,
                           language = "en")

prepped <- prepDocuments(processed$documents,
                         processed$vocab,
                         processed$meta,
                         lower.thresh = 20)

LDA(processed)
LDA(prepped)

> Error in x != vector(typeof(x), 1L)

LDA(processed$documents)
LDA(prepped$documents)

> Error in !all.equal(x$v, as.integer(x$v)) 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source