vendredi 27 mai 2016

Alternative to ifelse in R? Need to use two column in one table to match to a second table and bring output [duplicate]

This question already has an answer here:

I'm new to R so bear with me..

I have one table that looks like this (hundreds of rows long)

Col1 Col2   
1       1
16      6
36      3
5       8
2       26

... ...

My second Table looks likes this (has over 600 rows)

Col1   Col2    Output Column
1       1          849
29      3          348
4       4          584
5      36          373 
36      36        1902

I need to match Col 1 and Col2 in each table so that the combination of unique combination of Col1 and Col2 in table 2 returns the value in the Output column of Table 2.

I know I could spend hours writing a nested ifelse statements but there has to be a more efficient way to do this.

Any help is appreciated, even if you could just provide some stuff to look into.

Aucun commentaire:

Enregistrer un commentaire