Can´t knit: Error in knn(..) : no missing values are allowed

Hi everyone!

When I try to knit my document the following error appears:

But I don´t seem to have any missing data and I can run perfectly the command manually:


 table(is.na(test))
  FALSE 
1122000 

table(is.na(train))
  FALSE 
2278000 

table(is.na(train_label))
FALSE 
 6700
 bin_test_pred_1 <- knn(train = train, test = test, cl =train_labelbin, k = 1,
                        prob = TRUE)

Does anyone know where the issue migth be?

Thanks in advance,
Jose

Not sure if this might be the reason for you but I have also faced a similar kind of issue.

Maybe you have manipulated your data in the environment but not in the same way in the script of the knit file. Double-check your codes how data is read and what steps are used to create objects on the knit file.