data.table
of topic proportions.Combines the document-topic loadings (theta) with metadata to create a data.table
object for easy querying.
make.dt(model, meta = NULL)
The stm
model.
Optionally, the metadata object passed to the stm
model.
This is a simple utility function that creates a data.table object which you can use to create
more complicated queries than via findThoughts
. Topics are named via the convention
Topic#
, for example Topic1
, Topic2
etc. The object also contains docnum
which gives the index of the document so you can set keys without worrying about the texts getting
disconnected.
We expect that for the vast majority of users the functionality in findThoughts
will be
sufficient.
findThoughts
dt <- make.dt(gadarianFit, meta=gadarian)
#now we can do any query. For example the 5 least associated documents with Topic 2 in
#the treated group
dt[treatment==0, docnum[order(Topic2, decreasing=FALSE)][1:5]]
Run the code above in your browser using DataLab