threshold_distance | R Documentation |
Computes the distance between rows and returns those that fall below threshold
threshold_distance(
data,
threshold,
cols = c("x", "y"),
id_col = "ID",
extra_columns = NULL,
as_dataframe = FALSE,
check_id = TRUE,
distance_type = c("euclidean", "haversine")
)
data |
|
threshold |
Maximum distance to return |
cols |
Names of columns of numeric data. The data will first be sorted on the first of these. |
id_col |
Name of column holding ID data |
extra_columns |
Names of other columns to expand into the results based on indices. Two new elements will be made for each, one for the i index and one for the j index. |
as_dataframe |
|
check_id |
Whether the ID variable should be checked for inclusion |
distance_type |
What distance function to use |
Computes the distance between rows and returns those that fall below threshold
.
If two rows have the same ID, they will not be compared and the row-pairs will not be returned.
Either a list
or data.frame
showing which IDs matched with other
IDs, the distance between them and the rows numbers where the pairs occured.
Jared P. Lander
thedf <- data.frame(
ID=rep(LETTERS[1:3], length.out=10),
x=sample(10),
y=sample(10),
extra1=sample(letters, size=10),
extra2=sample(letters, size=10),
extra3=sample(10)
)
threshold_distance(thedf, threshold=3, as_dataframe=FALSE)
threshold_distance(thedf, threshold=3, as_dataframe=TRUE)
threshold_distance(thedf, threshold=3, as_dataframe=TRUE, check_id=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.