---
layout: post
title: "Refactoring R code to make it faster and more memory efficient (CC281)"
blurb: "Refactoring with TDD"
author: "PD Schloss"
date: 2024-05-09 11:00
comments: false
youtube: hRkotTsAjTg
start_hash: efa100b52fe169ea0f1da2bd061abb2f2201a929
end_hash: bc3ba05ef5a499d1d3792984b7e9e843ad38dd09
---

Based on the extensive benchmarking Pat's been doing in recent episodes, it's now time to apply his results to get the code running without blowing out the required amount of RAM. Pat will use the test driven development (TDD) framework to refactor his code to have confidence that the improved code is correct. He also does a quick benchmarking comparison of table and tabulte. 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}})
