View source: R/select_neighbours.R
select_neighbours | R Documentation |
Function select_neighbours
selects subset of rows from data set.
This is useful if data is large and we need just a sample to calculate profiles.
select_neighbours( observation, data, variables = NULL, distance = gower::gower_dist, n = 20, frac = NULL )
observation |
single observation |
data |
set of observations |
variables |
names of variables that shall be used for calculation of distance.
By default these are all variables present in |
distance |
the distance function, by default the |
n |
number of neighbors to select |
frac |
if |
Note that select_neighbours()
function is S3 generic.
If you want to work on non standard data sources (like H2O ddf, external databases)
you should overload it.
a data frame with selected rows
library("ingredients") new_apartment <- DALEX::apartments[1,] small_apartments <- select_neighbours(new_apartment, DALEX::apartments_test, n = 10) new_apartment small_apartments
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.