From the course: R for Data Science: Lunch Break Lessons

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Joins: Inner and full

Joins: Inner and full

- [Instructor] If you're familiar with SQL, you're familiar with the phrases: INNER JOIN or FULL JOIN. And you're probably wondering how to do that with data frames NR. So, let's take a look at some of the commands that enable us to emulate INNER JOINS and OUTER JOINS. First, I need a couple of data frames, so I'll create df1 and df2. And it's important to look at what these things look like; df1 is a series of rows of capital letters followed by an index number; one through 26, df2 is lower case letters followed by an index of one through, well, not 26. It goes 15, 20, and it jumps around a bit. And that's just to demonstrate how these rules will line up. We'll use df index as our common key to merge the two databases together. So, how do we do an INNER JOIN? In an INNER JOIN returns rows when there is a match in both tables. The command is simple, it's merge. And I merge df1 with df2. I'm going to hit control return. Down in the console we can see that I have a merge between df1 and…

Contents