How about this: > x 1 2 1 joe 0.45 2 mike 0.34 3 jim 0.25 > combine <- combn(3, 2) > combine [,1] [,2] [,3] [1,] 1 1 2 [2,] 2 3 3 > ans <- cbind(x[combine[1,],2], x[combine[2,], 2]) > rownames(ans) <- paste(x[combine[1,], 1], x[combine[2,], 1], sep='.') > ans [,1] [,2] joe.mike 0.45 0.34 joe.jim 0.45 0.25 mike.jim 0.34 0.25 > >
On 2/7/07, Serguei Kaniovski <[EMAIL PROTECTED]> wrote: > > Hallo, > > I have a table of names and values: > joe 0.45 > mike 0.34 > jim 0.25 > > I would like to fill-in a table of all pairs of names (which I aleady have) > joe.mike NA NA > joe.jim NA NA > mike.jim NA NA > > with the values from the first table in the order of the pairs. The outcome > looks like > joe.mike 0.45 0.34 > joe.jim 0.45 0.25 > mike.jim 0.34 0.25 > > Thanks a lot, > Serguei > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.