knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-" )
bigo
(big-O) is an R package designed to make it quick and easy to measure and visualize the runtime complexity of algorithms in your code. It emphasizes empirical runtime measurements--in numerical values and plots--rather than theoretical complexity analysis. This functionality is useful for researchers evaluating their algorithms, students learning computer science concepts, and many other R users.
You can install bigo
from GitHub.
# install.packages("devtools") devtools::install_github("bfgray3/bigo")
Below we deomonstrate the most basic functionality of bigo
with a simple Fibonacci function.
library(bigo) fib <- function(n) { if (n < 1) { stop("`n` must be a positive integer.", call. = FALSE) } else if (n < 3) { return(1) } else { return(Recall(n - 1) + Recall(n - 2)) } } plot(bigo(f = fib, n = seq(from = 2, to = 30, by = 2)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.