[R] rearranging data frame rows

Federico Calboli f.calboli at imperial.ac.uk
Fri Jun 23 18:10:08 CEST 2006

Hi All,

I have two data frames. The first contains data about a number of individuals, 
coded in the first column with a name, in an order I find convenient.

The second contains different data about the same indivduals, in a different 
order. Both data frame have the individual names in the first column.

I need to reorder the second data frame so the rows are rearranged in the same 
manner as the fist. How?

I cannot turn the individual names in a numeric vairable with 
as.numeric(data1[,1]), because the two data frames are subset of different data, 
so the the factor levels are way off between the two. I think I need to actually 
use the names as a index.



Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St Mary's Campus
Norfolk Place, London W2 1PG

Tel  +44 (0)20 7594 1602     Fax (+44) 020 7594 3193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com

More information about the R-help mailing list