R: merge similarity functions, #706