Error in table(data, reference, dnn = dnn, ...) : all arguments must have the same length error while making confusion matrix.

The error message comes from this line of code, apparently prediction7 and test7 don't have the same number of rows, possibly because there are NAs in test 7 but we can't be sure with out a proper REPRoducible EXample (reprex).