nn: Nearest interpolation

Description Usage Arguments Details Value See Also Examples

View source: R/nn.R

Description

Find the nearest neighbor for a set of data points

Usage

1
nn(p, y, q)

Arguments

p

matrix of variable values, each row is a data point

y

vector of values, each entry corresponds to one row in p

q

vector of variable values, each entry corresponds to one column of p

Details

nn finds the n-dimensional nearest neighbor for given datapoint

Value

an interpolated value for q

See Also

Other interp: bezier, bilinear(), cubicspline(), linterp(), polyinterp(), pwiselinterp()

Examples

1
2
3
4
p <- matrix(floor(runif(100, 0, 9)), 20)
y <- floor(runif(20, 0, 9))
q <- matrix(floor(runif(5, 0, 9)), 1)
nn(p, y, q)

cmna documentation built on July 14, 2021, 5:11 p.m.