added kellyo 1NN R function