Skip to content
Prev 305378 / 398506 Next

how to create a substraction matrix (subtract a row of every column from the same row in other columns)

csmeredith <csmeredith <at> fs.fed.us> writes:
[snip]
[snip]


  You might want to start with (something like)

library(reshape2); subset(melt(outer(x,x,"-")), Var1>Var2)

and then remove redundant rows ...

  I haven't actually tested any of that, but it should get you
started.