Learn R Programming

cmna (version 1.0.5)

nn: Nearest interpolation

Description

Find the nearest neighbor for a set of data points

Usage

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

Value

an interpolated value for q

Details

nn finds the n-dimensional nearest neighbor for given datapoint

See Also

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

Examples

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab