---
layout: post
title: "Benchmarking R functions for reading tsv files (CC291)"
blurb: "Tradeoffs between performance and dependencies"
author: "PD Schloss"
date: 2024-06-24 9:00
comments: false
youtube: bdKm51i8GP8
start_hash: 0d331fffdf9f229e0e32a14a29a1dd9e8caea22f
end_hash: f4e4dbecb4335c057b1567e923bf549ac395f096
---

Reading data tables into R is a very common activity and there are many ways to do this in base R with read.delim or with the read_tsv function from readr, the vroom function from the vroom package, or the fread function from data.table. Pat will benchmark these four approaches and discuss the tradeoffs between speed and dependencies for package development. Then he implements readr::read_tsv with test driven development (TDD) to create a read_taxonomy function in his phylotypr R package. 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}})
