This is because the topics object doesn't contain an attribute called probs when the model is called with only a content covariate, so topics <- labelTopics(stm.out, n=3)[[labeltype]] in line 103 of the function produces a NULL object and line 105 then errors out.
The error can be avoided by including labeltype = 'topic' in the function call to stmBrowser, so perhaps it's an issue for the docs... or a tryCatch() could be added. Sorry, I wouldn't have written a PR but I don't know R that well. Thanks for the cool function!
To reproduce:
This is because the
topics
object doesn't contain an attribute calledprobs
when the model is called with only a content covariate, sotopics <- labelTopics(stm.out, n=3)[[labeltype]]
in line103
of the function produces aNULL
object and line105
then errors out.The error can be avoided by including
labeltype = 'topic'
in the function call tostmBrowser
, so perhaps it's an issue for the docs... or atryCatch()
could be added. Sorry, I wouldn't have written aPR
but I don't knowR
that well. Thanks for the cool function!