I have 2 datasets as shown below and I want to achieve below result in R

table 1

rbd | carrier |
---|---|

A | EK |

B | EK |

C | EK |

W | QR |

Y | QR |

J | QR |

table 2

carrier | flight | leg |
---|---|---|

EK | 1 | DXBBOM |

EK | 2 | BOMLHR |

EK | 3 | DXBDEL |

QR | 7 | DXBLON |

QR | 8 | JFKLHR |

QR | 9 | MXPDWE |

desired o/p is

for every carrier flight leg from table 2 should be mapped to every rbd carrier same carriers combination

carrier | flight | leg | rbd |
---|---|---|---|

EK | 1 | DXBBOM | A |

EK | 1 | DXBBOM | B |

EK | 1 | DXBBOM | C |

EK | 2 | BOMLHR | A |

EK | 2 | BOMLHR | B |

EK | 2 | BOMLHR | C |

EK | 3 | DXBDEL | A |

EK | 3 | DXBDEL | B |

EK | 3 | DXBDEL | C |

QR | 7 | DXBLON | W |

QR | 7 | DXBLON | J |

QR | 7 | DXBLON | Y |

QR | 8 | JFKLHR | W |

QR | 8 | JFKLHR | J |

QR | 8 | JFKLHR | Y |

. | |||

. |

EK cxr with all ek ebds, QR carrier with all qr rbd

Please advise