I need to calculate all pairwise abs differences among many variables (there are 100 in my dataset). I expect to get one column for each difference:
I have tried the next function but it summarizes the results, and I do not need the sum, but all the single abs differences.
outer(seq_along(rio_csv), seq_along(rio_csv), FUN =
Vectorize(function(i, j)abs(sum(rio_csv[[i]] - rio_csv[[j]], na.rm = FALSE))))
data
df <- data.frame(v1=1:6,V2=7:12,V3=13:18,v4=19:24,v5=25:30,v6=31:36)