How to check whether a vector in a matrix in R?

playing with iris Fischer R, wrote a kNN classifier for a single point and so decided to write a cycle that would categorise each point on the chart used for this design
xl <- iris[, 3:5]
for (i in seq(0.8,7.5,by=0.1)){
 for (j in seq(-1,3.5,by=0.1)){
 z <- c(i, j)
 class <- kNN(xl, z, k=6)
 points(z[1], z[2], pch = 21, bg = "white", col=colors[class], asp = 1)

but when it comes to real points from the sample it will pick up checked how to do in a cycle, these points were skipped and not subjected to classification?
June 14th 19 at 18:02

Find more questions by tags Machine learningR