What does the cl option in KNN signify

knn
r

#1

Hello,

While trying to use KNN on a classification problem in R:

What does this cl option do exactly?
I went through the documentation and it says that cl is the factor of true classification of training set.Does this mean that I will need to create another vector containing the classes which I want to predict or more specifically which exist in the data??
Can’t we do something like label ~ . like in random forests??
Can someone please help me with this!


#2

@data_hacks -cl is basically contains the classes of training data ,yes you have to create a vector of classes in training set.

Hope this helps!
Regards,
hinduja1234