[R] match problem

Bunny, lautloscrew.com bunny at lautloscrew.com
Tue Dec 15 13:50:46 CET 2009


Hi all, 

I dont know if match is the right approach here. I´d like to match to data.frames. One big dataframe and one small dataframe. In SQL, what i want to do what only be simple relation. 

The first consists of two columns a) some value b) some key that is explained in the other dataframe. What i want to do is create (cbind) both to one dataframe like:

df1:

a  b
1  2  
2  3
3  2
4  2
5  1

df2: 
1 class1
2 class2
3 class3


to newdf: 

a b class
1 2 class2
2 3 class3
3 2 class2 
...
and so forth

I have connected R to several relational databases but I dont think it´s necessary here and that there should be a simpler solution for my problem. Maybe some combination of do.call, mapply, lapply or match can do the job. 
Unfortunately I am not really familiar with these and still keep tryin.

thx in advance for any help.

Best regards

matt




More information about the R-help mailing list