Here is my code:
train_points <- read.table(\"kaggle_train_points.txt\", sep=\"\\t\")
train_labels <- read.table(\"kaggle_train_labels.txt\", sep=\"\\t
I had the same issue in trying to apply knn on breast cancer diagnosis from wisconsin dataset I found that the issue was linked to the fact that cl argument need to be a vector factor (my mistake was to write cl=labels , I thought this was the vector to be predicted it was in fact a data frame of one column ) so the solution was to use the following syntax : knn (train, test,cl=labels$diagnosis,k=21) diagnosis was the header of the one column data frame labels and it worked well Hope this help !