[R] Eye Diagram from a Topic Model

Peter Maclean pmaclean2011 at yahoo.com
Sat Jul 25 21:30:09 CEST 2015


Is it possible to reproduce the eye-diagram described here from the topic model/
https://github.com/ouzor/eyediagram/blob/master/example.R 


and shown here:
https://github.com/ouzor/eyediagram/blob/master/example/ExampleEyeDiagram.pdf

The code do not work in processing as suggested by the author and the outhor seems 
not to be interested in developing the code further. Here is a toy
topic model using yahoo headline news to start with. 
###############################################################
library(XML)
source <- "http://finance.yahoo.com/q/h?s=AAPL+Headlines"
d <- htmlParse(source)
text <- as.data.frame(xpathSApply(d, "//ul[contains(@class,'newsheadlines')]/following::ul/li/a", xmlValue))
colnames(text) <- c("topics")
fix(text)
library(stm)
#Stemming/stopword removal
textss <- textProcessor(text$topics, metadata=text)
#str(textss)
model <- stm(textss$documents, textss$vocab, K=10, data=textss$meta, seed=5678)
labelTopics(model)
plot.STM(model, text.cex=0.8, type='summary', xlim=c(0, 0.5), n=4)
#How can we create an eye-diagram with document-topic-words



More information about the R-help mailing list