I got this message when I code a confusionMatrix: "Error in confusionMatrix.default(prediccion_1900, testing_1900$Genero) :
The data contain levels not found in the data."
str():
prediccion_1900 str() it´s a factor
testing_1900$Genero str() it´s a data.frame
in testing_1900$Genero , I TRIED many times to remove the separate symbol like this, but it does´t work....... ,sep = "([|])",remove = F
testing_1900$Genero = fct_expand(testing_1900$Genero,levels(factor(testing$Genero))[2:20]) # More levels added to analize the error
set.seed(100)
prediccion_1900 = predict(modelo, newdata = testing_1900, type = "class") # type class so it doesn´t affect the number of levels less
confusionMatrix(prediccion_1900, testing_1900$Genero)