For example, I want to classify R1 based on R2. R1 is like
# A tibble: 5 x 2
lon lat
<dbl> <dbl>
1 1 2
2 3 5
3 6 8
4 5 10
5 3 2
and R2 is like
# A tibble: 3 x 3
lon lat place
<dbl> <dbl> <chr>
1 1 2 A
2 3 6 B
3 5 8 C
R2 is like a standard. I want to find the corresponding place for my observations in R1. Suppose the 1st place in R1 is graded like:
- scores of A: (1-1)^2 + (2-2)^2 = 0
- scores of B: (1-3)^2 + (2-6)^2 = 20
- scores of C: (1-5)^2 + (2-8)^2 = 52 If the scores of any place may be smaller than 3, we classify this place into the class. The final result should be like this
# A tibble: 5 x 2
lon lat place
<dbl> <dbl> <chr>
1 1 2 A
2 3 5 B
3 6 8 C
4 5 10 NA
5 3 2 NA