Evaluating the performance of various methods for generating vectors in R (CC275)

April 18, 2024 • PD Schloss • 1 min read

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.

Code

You can browse the state of the repository at the