title: "Error in knn (...) no missing values are allowed", why?
body: <p>I have a test set with missing values in the class variable.
  When running knn I get the error message:</p>
  
  <blockquote>
    <p>"Error in knn (...) no missing values are allowed".</p>
  </blockquote>
  
  <p>Question: Why doesn't knn allow the values of the class variable in the test set to be missing? I mean, I don't know those values, I want to predict them. 
  Can I just assign some class to the class variable and still get the correct result?</p>
  
  <p>Example code:</p>
  
  <pre><code>library(class)
  data &lt;- data.frame("class_variable"=sample(LETTERS[1:2], 30, replace =     TRUE),
                 "predictor_1" = runif(30),
                 "predictor_2" = runif(30))
  train &lt;- data[1:20,]
  test &lt;- data[21:30,]
  
  test$class_variable &lt;- NA
  
  knn(train, test, train$class_variable)
  </code></pre>
  
  <blockquote>
    <p>Error in knn(train, test, train$class_variable) : 
      no missing values are allowed</p>
  </blockquote>