library(quanteda)
library(quanteda.textmodels)
# Transform corpus to dfm
data(data_corpus_irishbudget2010, package = "quanteda.textmodels")
ie_dfm <- dfm(tokens(data_corpus_irishbudget2010))
# Set reference scores
refscores <- c(rep(NA, 4), 1, -1, rep(NA, 8))
# Predict Wordscores model
ws <- textmodel_wordscores(ie_dfm, y = refscores, smooth = 1)
# Plot estimated word positions (highlight words and print them in red)
textplot_scale1d(ws,
highlighted = c("minister", "have", "our", "budget"),
highlighted_color = "red")
Error in textplot_scale1d(ws, highlighted = c("minister", "have", "our", : could not find function "textplot_scale1d"
CodePudding user response:
You need to add library("quanteda.textplots")
to the top, since that package contains the function textplot_scale1d()
.