Can't get a crosstable!

Hi all,

I'm doing a KNN on the Employee Attrition dataset and I have installed gmodels package, but I still can't get the crosstable (see PrtSc).
This is what I did:

cl = Leaver_train[,1]
Leaver_train_pred <- knn(train = Leaver_train, test = Leaver_train, cl, k=25)
Leaver_test_pred <- knn(train = Leaver_train, test = Leaver_test, cl, k=25)
CTtrain=CrossTable(x=Leaver_train_labels,y=Leaver_train_pred, prop.chisq=FALSE)
Error in CrossTable(x = Leaver_train_labels, y = Leaver_train_pred, prop.chisq = FALSE) :
x and y must have the same length

Any one an idea how to fix this?

Thanks in advance

We need a reproducible example (reprex)

Unfortunately this soution doesn't work on this dataset

This was not a solution. It is a guide to how to ask questions here.