I have two data frame of different dimension, here an example:
df1 <- data.frame(
ID = c(1:7),
coordinate = c(1, 5, 6, 4, 3, 7, 9),
var1 = c(0, 0, 3, 1, 0, 1, 3),
var3 = c(0, 0, 0, 1, 1, 6, 1))
df2 <- data.frame(
ID = c(1, 5, 3),
coordinate = c(1, 7, 6),
area_name = c("A", "B", "C"))
The "coordinate" columns of both df1 and df2 have some points in common.
I would like to assign to each coordinate of df1 the corrisponding area_name from df2
I may use the "coordinate" values as pivot to join them, but I cannot reach a correct way.