Learn R Programming

intrinsicDimension (version 1.2.0)

neighborhoods: Obtaining neighborhoods (local data) from a data set

Description

Get a list of neighborhoods, each containing the k nearest neighbors (not including itself) to a point in the data set.

Usage

neighborhoods(data, k, indices, eps=0.0)

Arguments

data

A data set.

k

The number of neighbors in each neighborhood.

indices

A vector with indices of the points in data that should be used as center for neighborhoods.

eps

If non-zero, the relative error in distance allowed when finding nearest neighbors. See Details.

Value

A list of neighborhoods where each item corresponds to one index in indices and each item contains a data set with k data points.

Details

The ann function of the package yaImpute is used for finding the k nearest neighbors. The eps parameter to neighborhoods is used in the ann function.

Examples

Run this code
# NOT RUN {
data <- swissRoll3Sph(300, 300)
neighborhoods(data, 10, 1:10)
# }

Run the code above in your browser using DataLab