Hi Fede,

How about using merge()? For example:

n <- letters[1:10]
d1 <- data.frame( n=n, x1=rnorm(10) )
d2 <- data.frame( n=sample(n), x2=rnorm(10))
d1
d2
merge(d1,d2)


Is this what you had in mind?

HTH,

Michal




========================================================================
============
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.

Cheers,

Fede

~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~
 
Michal Bojanowski
ICS / Utrecht University
Heidelberglaan 2; 3584 CS Utrecht
Room 1428
[EMAIL PROTECTED]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to