make.dt {stm}R Documentation

Make a data.table of topic proportions.

Description

Combines the document-topic loadings (theta) with metadata to create a data.table object for easy querying.

Usage

make.dt(model, meta = NULL)

Arguments

model

The stm model.

meta

Optionally, the metadata object passed to the stm model.

Details

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.

See Also

findThoughts

Examples

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]]


[Package stm version 1.3.7 Index]