knitr::opts_chunk$set(eval = T, echo = TRUE)
Please read Preparation for the reading of documents and creating a list of keywords. We use bills data we prapared (documents and keywords).
library(keyATM) data(keyATM_data_bills) bills_keywords <- list( Education = c("education", "child", "student"), Law = c("court", "law", "attorney"), Health = c("public", "health", "program"), Drug = c("drug", "treatment") ) library(quanteda) bills_dfm <- keyATM_data_bills$doc_dfm # quanteda object keyATM_docs <- keyATM_read(bills_dfm)
out <- keyATM(docs = keyATM_docs, # text input no_keyword_topics = 3, # number of topics without keywords keywords = bills_keywords, # keywords model = "base", # select the model options = list(seed = 50) )
The default number of iterations is 1500
. Please check this page for available options.
Once you fit the model, you can save the model with save()
for replication.
save(out, file="SAVENAME.rds")
To load the model, you can use readRDS()
function.
out <- readRDS(file="SAVENAME.rds")
top_words(out)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.