modelToDataframe: Run LDA on a Mallet instance

Description Usage Arguments Value See Also Examples

Description

Run LDA on a Mallet instance

Usage

1
2
modelToDataframe(topic.model, prepped_corpus, n.topics = n.topics,
  num.topwords = 5, textcolname = "text", incCorpusText = TRUE)

Arguments

topic.model

topic.model usually taken from make_model, a Mallet object

prepped_corpus

data.frame usually taken from prep_corpus, a data.frame with fields for text, journal, date

num.topwords

numeric number of words to display on topic labels

textcolname

string the name of the text column from prepped_corpus

incCorpusText

logical whether or not to include the raw text data from prepped_corpus in the final data.frame to be output

Value

a data.frame of topic frequencies by document that we can analyze and graph

See Also

prep_corpus, which creates the data.frame this function draws on make_model, which creates the mallet object this function uses

Examples

1
2
3
4
date_vec <- date_vec
dataframe <- stripped_xmlData
marsden_journals <- make_model(dataframe, 10, journalVec = c("Blast", "Egoist", "Freewoman", "NewFreewoman"))
marz.df <- train_model(marsden_journals, dataframe, c("Blast", "Egoist", "Freewoman", "NewFreewoman"))

mlinegar/litMagModelling documentation built on May 23, 2019, 2:12 a.m.