How to use Naive Bayes for multi-label text classification in R. I tried using naiveBayes() from e1071 library but it seems that while training, it doesn't accept multi-label class variable.I created TermDocumentMatrix using the text document corpus and tried to create the model using this matrix and class variable(list of topics a particular document belongs to). Below is the code that I used.trainvector <- as.vector(traindata$bodyText)trainsource <- VectorSource(trainvector)traincorpus <- Corpus(trainsource)trainmatrix <- t(TermDocumentMatrix(traincorpus))model <- naiveBayes(as.matrix(trainmatrix), as.factor(traindata$topics))The last line gives below error:Error in sort.list(y) : 'x' must be atomic for 'sort.list'Have you called 'sort' on a list?I tried using model <- naiveBayes(as.matrix(trainmatrix), as.factor(unlist(traindata$topics)))but got error:Error in tapply(var, y, mean, na.rm = TRUE) :   arguments must have same length
Naive Bayes for Multi label text classification
multilabel classification;naive bayes classifier