by_distance_rearranger_ | R Documentation |
Wrapper for running closest to / furthest from rearrange methods
by_distance_rearranger_(
data,
cols,
origin = NULL,
origin_fn = NULL,
shuffle_ties = FALSE,
decreasing = FALSE,
origin_col_name = ".origin",
distance_col_name = ".distance",
overwrite = FALSE
)
data |
|
cols |
Column(s) to create sorting factor by.
When |
origin |
Coordinates of the origin to calculate distances to.
A scalar to use in all dimensions
or a N.B. Ignored when |
origin_fn |
Function for finding the origin coordinates. Input: Each column will be passed as a Output: A Can be created with E.g. Built-in functions are |
shuffle_ties |
Whether to shuffle elements with the same distance to the origin. (Logical) |
decreasing |
Whether to order by decreasing distances to the origin. (Logical) |
origin_col_name |
Name of new column with the origin coordinates. If |
distance_col_name |
Name of new column with the distances to the origin. If |
overwrite |
Whether to allow overwriting of existing columns. (Logical) |
The sorted data.frame
(tibble
) / vector
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.