Left join only selected columns in R

If you want to use dplyr left join or any other type of join in R to combine information from two or multiple data frames, this post might be very helpful. Here is how to left join only selected columns in R.

The first data frame.

The second data frame.

How to perform dplyr left join and keep only necessary columns from the second data frame? In this case, let’s keep only elephants and cats.

To do that, use the select function that defines what comes from the second data frame.

Here are two different ways of how to do that.

Here is another post that might be useful in your toolbox – multiple left joins in R.

0 comments on “Left join only selected columns in R

Leave a Reply

Your email address will not be published. Required fields are marked *