Skip to content
Prev 305137 / 398506 Next

pairwise comparisions

On Sep 10, 2012, at 7:00 AM, priya wrote:

            
How new? Is this still in a file? ... or has it been imported to an R object. If it really still is in a file,  then Bert's suggestion of first reading "Intro to R" rather than posting to R help is on point. If it is an R object, you _should_ have used dput(head(obj)) to provide an appropriate test case for solutions.
Let's assume it's in a matrix of data.frame named X. To get pairwise combinations try:

CX <- combn( colnames(X), 2)

That's going to be a 2 row character matrix. Perhaps this will work but since you provide not example it will remain untested.

apply(CX, 2, function(comb), pmin(X[, comb[1]], X[, comb[2]] ) )