---
layout: post
title: "Evaluating the performance of various methods for generating vectors in R (CC275)"
blurb: "Benchmarking R's vectors (part 2)"
author: "PD Schloss"
date: 2024-04-18 11:00
comments: false
youtube: fxk2xocatL4
start_hash: 2825e220a4ede03a9a99a06241e90a0b6701b43e
end_hash: d565825528db5dea965b5ffd5da70d90053c7300
---

What is your preferred method for building a vector in R? Do you know its performance characteristics relative to other methods and the size of the vector? In this tutorial, Pat compares 12 methods of building vectors and shows how they compare to each other as well as with increasing size of the vector. He uses the microbenchmark package to evaluate their speed for different sized vectors. Rcpp, purrr, and the base and magrittr pipes will also make an appearance. You'll likely be surprised by the results! 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/phylotyper/tree/{{page.start_hash}})
* [end of the episode](https://github.com/riffomonas/phylotyper/tree/{{page.end_hash}})
