nn2: Extension of nn method for two matrices

Description Usage Arguments Details Value Examples

Description

Find k or fixed radius nearest neighbors of each observation(row) matrix y in matrix x

Usage

1
nn2(x, y, k, r, method = "euclidean", ...)

Arguments

x

Numeric matrix

y

Numneric matrix

k

Number of nearest neighbors

r

Radius for nearest neighbors

method

(string or function) Distance metric passed to 'proxy::dist'

...

Additional arguments are sent to pbmclapply

Details

Exactly one among k or r has to be provided

Value

Object of class 'nn'. A list with these elements:

Examples

1
2
3
4
5
temp <- nn2(x = matrix(rnorm(1e4), ncol = 10)
            , y = matrix(runif(1e3), ncol = 10)
            , r = 2
            )
temp

talegari/disto documentation built on May 10, 2019, 3:19 a.m.