I have two dataframes: df1 contains observations with lat-lon coordinates; df2 has names with lat-lon coordinates. I want to create a new variable
df1
df2
Like this:
df1$name <- df2$latlonloc[apply(mat, 1, which.min)]