Dist2All {BIDistances}R Documentation

Distances to all data points

Description

Calculates all distances from a given vector to the rows of a matrix.

Usage

Dist2All(X, Data, SelectFeatures, method = "euclidean",p=2,knn=1)

Arguments

X

A vector containing the data point to be compared to data.

Data

A matrix containing the data points to be compared with x.

SelectFeatures

A vector of the same length as x and the rows of data, containing TRUE for all columns of the data to be compared and any other value for columns to be discarded.

method

(Optional) String marking, which distance measure is to be used. Euclidean by default.

p

(Optional) Scalar, The pp-th root of the sum of the pp-th powers of the differences of the components. Default is 2

knn

(Optional) Scalar, gives the number of the indices of the k nearest neighbors returned. Default is 1

Value

List with

distToAll

A vector containing the distances from x to all rows of data.

KNN

Numeric vector, containing the indices of the k nearest neighbors (rows) to the given points

Note

This function is very inefficient for large Data.

Author(s)

Michael Thrun

Examples

data(Hepta)
Dist2All(Hepta$Data[1,],Hepta$Data)

[Package BIDistances version 0.1.3 Index]