R error: all arguments must have the same length

For some reason, the default predict(efit, test_data, type = “class”) doesn’t work in this case (probably because your model predicts 0 for all observations in the test dataset). You also need to construct the table using your outcome (i.e. test_data[,ncol(test_data)] returns euribor3m). The following should work: