so I have a data frame containing certain type of data for different stocks, sample as followed:
Date RY TD BNS... 10-01 2.98 2.29 1.91 10-02
As suggested by Alistaire, apply can be easily used for this
apply(df[, -1], 1, function(x) { sum(combn(x, 2, prod)) } )
You could also use package parallel and use mcapply* functions to run it in multicore modes