findKNN | R Documentation |
relise on RANN library for actual calculation. Simply reformats the results into a mapping table format
findKNN( sourceDf, targetDf, sourceIdVar, targetIdVar, k = 4, matchVars = vars(long, lat), distanceVar = "distance", rankVar = "rank", ... )
sourceDf |
a dataframe with a unique Id column |
targetDf |
a dataframe with a unique Id column |
sourceIdVar |
the unique Id column of the sourceDf |
targetIdVar |
the unique Id column of the targetDf |
k |
the k of knn |
matchVars |
the columns to calculate the distance on - must be numerics and present in both sourceDf and targetDf, escaped by vars(...) |
distanceVar |
what will the distance measure be named? |
... |
other parameters passed onto RANN::nn2() |
a dataframe containing sourceIdVar, targetIdVar, distanceVar and k columns
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.