How would you do a left and right join in R?

We’ll be using the help of “dplyr” package to make a left join and right join.

We have two data-sets → employee salary and employee designation:

Employee_designation->

emp_desig

Employee_salary->

emp_sal

Let’s do a left join on these two data-sets using “left_join()” function from dplyr package:

left_join(employee_designation,employee_salary,by="name")

Result->

left_join

Now, let’s perform a right join between these two data-sets:

right_join(employee_designation,employee_salary,by="name")

Result->

right_join