在R中对STM模型运行协变量时遇到问题。对我有什么解决此问题的建议吗?
library(quanteda)
data <- read.csv("nr_11r.csv")
data$documents <- as.character(data$documents)
data$gender <- as.factor(data$gender)
data$date <- as.Date(data$date, "%m/%d/%Y")
data$day <- as.numeric(format(data$date, "%d"))
test <- corpus(data, text_field="documents")
test_dfm <- dfm(test, remove_punct=T, remove=stopwords("english"))
test_dfm <- dfm_trim(test_dfm, min_termfreq = 2)
test_dfm <- test_dfm[rowSums(test_dfm) > 0, ] #remove empty rows
library(stm)
m <- stm(test_dfm, K = 40, max.em.its = 100, control=list(alpha=1))
#prevalence
m2 <- stm(test_dfm, K = 40, prevalence =~ day, max.em.its = 100)
prep <- estimateEffect(1:40 ~ day, stmobj = m2, meta =
docvars(test_dfm))
错误警告来自准备: posint(K)中的错误:找不到函数“ posint”