Re: [R] Sorting data in R according to the header of another table

2011-10-03 Thread R. Michael Weylandt
Try this: X = 1:5; names(X) = letters[sample(5)] Y = matrix(1:25, 5); colnames(Y) = letters[1:5] Y[ , names(X)] Hope this helps, Michael Weylandt On Oct 3, 2011, at 6:20 AM, "Samir Benzerfa" wrote: > Hi everyone, > > > > My (simplified) problem is the following one: I have two tables. The

[R] Sorting data in R according to the header of another table

2011-10-03 Thread Samir Benzerfa
Hi everyone, My (simplified) problem is the following one: I have two tables. The first table contains 5 columns with 5 values and the second table contains a single value for each vector name of the first table (see tables below): Table 1: A B C D