Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

make.dt

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

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

stm

Estimation of the Structural Topic Model

v1.3.6
MIT + file LICENSE
Authors
Margaret Roberts [aut], Brandon Stewart [aut, cre], Dustin Tingley [aut], Kenneth Benoit [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.