This function serves as an evaluation wrapper for some distance function. It checks that the output of distance_function is a numeric matrix with nrow(x) rows and nrow(y) columns as expected.

eval_distance(distance_function, x, y, data = NULL)

Arguments

distance_function

(function())
A distance function to evaluate.

x

(data.frame() | numeric())
A matrix or a data frame containing variables that should be used in the computation of the distance.

y

(data.frame() | numeric())
A matrix or a data.frame containing variables that should be used in the computation of the distance.

data

(data.frame() | NULL)
A data.frame or data.table containing the entire data set. This can be used to compute statistics used in the computation of the distance, e.g., standard deviation or range.