I am trying to analyse some tweets using the naive bayes method on R. However, I am having issues, below is my code. When I try and produce a text model, I keep getting told that y cannot be constant. I am not clear what this error message means or how to solve it.
Help would be much appreciated.
id_train <- sample(1:5000, 1500, replace = FALSE)
 2638 874 3650 3740 789 553 1705 4368 4557
MasterCorpus$id_numeric <- 1:ndoc(MasterCorpus)
dfmat_training <- corpus_subset(MasterCorpus, id_numeric %in% id_train) %>%
dfm(remove = stopwords("en"), stem = TRUE)
dfmat_test <- corpus_subset(MasterCorpus, !id_numeric %in% id_train) %>%
dfm(remove = stopwords("english"), stem = TRUE)
tmod_nb <- textmodel_nb(dfmat_training, dfmat_training$author)
Error in textmodel_nb.dfm(dfmat_training, dfmat_training$author) :
y cannot be constant