---
layout: post
title: "Benchmarking R functions for joining data frames (CC292)"
blurb: "Joins with base R, dplyr and data.table"
author: "PD Schloss"
date: 2024-07-01 9:00
comments: false
youtube: bdKm51i8GP8
start_hash: f66005b5a115301ff4827c5c68fa47d9bbc2f394
end_hash: cc51a6620b3e11f74aeae843444b925762ced547
---

We often need to join two or more data frames to link different pieces of data together. What's the most efficient way to do this in R? In this Code Club, Pat shows how to use base R's merge function as well functions from the dplyr and data.table packages to illustrate how to perform an inner join, full join, left join, and right join. He then benchmarks their performance to see which inner join option is the fastest. This episode is part of an ongoing effort to develop an R package that implements the naive Bayesian classifier.

<iframe style="margin: 0 auto;display:block;" width="560" height="315" src="https://www.youtube.com/embed/{{ page.youtube }}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

## Code

You can browse the state of the repository at the

* [beginning of the episode](https://github.com/riffomonas/phylotypr/tree/{{page.start_hash}})
* [end of the episode](https://github.com/riffomonas/phylotyprr/tree/{{page.end_hash}})
