# Spearman's footrule spearmanDistance <- function(Ra, Rb) { distance <- 0 for (x in Ra) { distance <- distance + abs(which(Ra==x)-which(Rb==x)) } return(distance) } # Kendall tau distance kendallDistance <- function(Ra, Rb) { distance <- 0 for (x in Ra) { for (y in Rb) { if (((which(Ra==x)which(Rb==y))) | ((which(Ra==x)>which(Ra==y)) & (which(Rb==x) [0,1] with 1 as maximum disagreement # https://en.wikipedia.org/wiki/Kendall_tau_distance