Description Usage Arguments Details Value See Also Examples
Estimate a structural topic model
1 2 3 4 5 6 7 8 9 10 11 |
data |
Data frame of parsed tweets. Obtained either by using |
n_topics |
Integer with number of topics. |
xcov |
Either a \[stats]formula with an empty left-hand side specifying external covariates
(meta data) to use.e.g. |
remove_punct |
Logical. Indicates whether punctuation (includes Twitter hashtags and usernames) should be removed. Defaults to TRUE. |
stem |
Logical. If |
remove_url |
Logical. If |
remove_emojis |
Logical. If |
stopwords |
a character vector, list of character vectors, dictionary or collocations object. See pattern for details. Defaults to stopwords("english"). |
... |
Additional arguments passed to stm. |
Use this to function estimate a STM from a data frame of parsed Tweets. Works with unpooled Tweets only. Pre-processing and fitting is done in one run.
Object of class stm. Additionally, pre-processed documents are appended into a named list called "prep".
stm
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Not run:
library(Twitmo)
# load tweets (included in package)
mytweets <- load_tweets(system.file("extdata", "tweets_20191027-141233.json", package = "Twitmo"))
# fit STM with tweets
stm_model <- fit_stm(mytweets, n_topics = 7,
xcov = ~ retweet_count + followers_count + reply_count +
quote_count + favorite_count,
remove_punct = TRUE,
remove_url = TRUE,
remove_emojis = TRUE,
stem = TRUE,
stopwords = "en")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.