[R] Replacing data from one data frame to another

Neil Leonard nleonard at tartarus.uwa.edu.au
Wed Oct 20 03:07:59 CEST 2004


Hi,

I have a data frame which contains two fields, 'prev' and 'mchnum'.

I have another data frame which also contains 'mchnum' and 'prev' and 
some other fields. The 'prev' data in this field is corrupted and I 
want to replace it with the data from the other data frame for matching 
values of 'mchnum' (which are unique). Is there an easier way of doing 
this than having two for loops and going through each field looking for 
matching values of 'mchnum' and then replacing the 'prev' value when 
they match.


Thanks
Neil




More information about the R-help mailing list