Allow method in match_on to be a function or c('mahalanobis','euclidean')