nearest neighbor method with python and R