stats and some in Dist in package amap. All this function does is determine which method is requested and then the distance calculation is done by the appropriate method. The exception is the cosine distance which is calculated locally.rowDist(x, method)c("pearson", "correlation", "spearman", "kendall", "euclidean", "maximum", "manhattan", "canberra","binary", "minkowski", "cosine").dist.c("euclidean", "maximum", "manhattan", "canberra","binary", "minkowski") are sent to function dist in package stats while methods c("pearson", "correlation", "spearman", "kendall") are handled by Dist in package amap. See the respective help pages for details. "cosine" is handled locally.