R is telling me that there are new levels in my string variable, but I don't see that when I print out the levels. "Electronic" is a level in both the test and training data set. The run log is below. I also tried a different subset of the data for the Predict stage and get a different set of levels listed as new. Any thoughts?
> levels(trainingData$Genre)
[1] "Alternative" "Christian & Gospel" "Country"
[4] "Dance" "Electronic" "Hip Hop / Rap"
[7] "Hip-Hop" "Pop" "Pop in Spanish"
[10] "R&B / Soul" "Rap" "Rock"
[13] "Soul" "Soundtrack"
> levels(testData$Genre)
[1] "Alternative" "Christian & Gospel" "Country"
[4] "Dance" "Electronic" "Hip Hop / Rap"
[7] "Hip-Hop" "Pop" "Pop in Spanish"
[10] "R&B / Soul" "Rap" "Rock"
[13] "Soul" "Soundtrack"
> testData$Genre[id] <- NA
> # Predict
> rankPred <- predict(lmMod, testData)
Error in model.frame.default(Terms, newdata, na.action = na.action, xlev = object$xlevels) :
factor Genre has new levels Electronic
Calls: predict -> predict.lm -> model.frame -> model.frame.default
Execution halted