M
M
MajorTom692017-10-07 11:40:36
R
MajorTom69, 2017-10-07 11:40:36

How to check if there is a vector in a matrix in R?

I play with Fisher's irises in R, I wrote a kNN classifier for one point and now I decided to write a cycle that would classify each point on the graph, I used this construction

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 a real point from the sample, it is repainted into a verified one, how can I make sure that these points are skipped in the loop and not subjected to classification?
59d892c9c3614019773055.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question