Last chance! 50% off unlimited learning
Sale ends in
textplot_scale1d(x, margin = c("documents", "features"), doclabels = NULL,
sort = TRUE, groups = NULL, highlighted = NULL, alpha = 0.7,
highlighted_color = "black")
"documents"
to plot estimated document scores (the
default) or "features"
to plot estimated feature scores by a measure
of relative frequencyTRUE
(the default), order points from low to high
score. If a vector, order according to these values from low to high. Only
applies when margin = "documents"
.margin = "documents"
.margin = "features"
margin = "features"
highlighted
textmodel_wordfish
, textmodel_wordscores
,
coef.textmodel
## Not run: ------------------------------------
# ie_dfm <- dfm(data_corpus_irishbudget2010)
# doclab <- apply(docvars(data_corpus_irishbudget2010, c("name", "party")),
# 1, paste, collapse = " ")
#
# ## wordscores
# refscores <- c(rep(NA, 4), -1, 1, rep(NA, 8))
# ws <- textmodel(ie_dfm, refscores, model="wordscores", smooth = 1)
# pred <- predict(ws)
# # plot estimated word positions
# textplot_scale1d(pred, margin = "features",
# highlighted = c("minister", "have", "our", "budget"))
# # plot estimated document positions
# textplot_scale1d(pred, margin = "documents",
# doclabels = doclab,
# groups = docvars(data_corpus_irishbudget2010, "party"))
#
# ## wordfish
# wfm <- textmodel_wordfish(dfm(data_corpus_irishbudget2010), dir = c(6,5))
# # plot estimated document positions
# textplot_scale1d(wfm, doclabels = doclab)
# textplot_scale1d(wfm, doclabels = doclab,
# groups = docvars(data_corpus_irishbudget2010, "party"))
# # plot estimated word positions
# textplot_scale1d(wfm, margin = "features",
# highlighted = c("government", "global", "children",
# "bank", "economy", "the", "citizenship",
# "productivity", "deficit"))
## ---------------------------------------------
Run the code above in your browser using DataLab