knn--NA/NaN/Inf in foreign function call (arg 6)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

knn--NA/NaN/Inf in foreign function call (arg 6)

suyu
This post has NOT been accepted by the mailing list yet.
> sum(is.na(x_train))
[1] 0
> sum(is.na(x_test))
[1] 0
> test_pred <- knn(x_train, x_test, factor(y_train), k = 10, prob = TRUE)
Error in knn(x_train, x_test, factor(y_train), k = 10, prob = TRUE) :
  NA/NaN/Inf in foreign function call (arg 6)
In addition: Warning messages:
1: In knn(x_train, x_test, factor(y_train), k = 10, prob = TRUE) :
  NAs introduced by coercion
2: In knn(x_train, x_test, factor(y_train), k = 10, prob = TRUE) :
  NAs introduced by coercion

where am i wrong?