library(stm)
data(poliblog5k)
#Create date
dec312007 <- as.numeric(as.Date("2007-12-31"))
poliblog5k.meta$date <- as.Date(dec312007+poliblog5k.meta$day,
origin="1970-01-01")
out <- prepDocuments(poliblog5k.docs, poliblog5k.voc, poliblog5k.meta)
stm.out <- stm(out$documents, out$vocab, K=10,
prevalence=~rating + date,
data=out$meta,
max.em.its=1) #generally run models
#longer than this.
library(stmBrowser)
setwd(tempdir())
stmBrowser(stm.out, data=out$meta, c("rating", "date"),
text="text")
#Remove files
unlink("stm-visualization", recursive=TRUE)
Run the code above in your browser using DataLab