Sometimes it’s a delight to see plots in a table. Here we provide recipes for a few common tasks using both kableExtra
’s built-in functions and external libraries, including ggplot2
, sparkline
and plotly
.
In terms of kableExtra
’s built-in plotting functions, since version 1.2.1, kableExtra
includes these functions for the most common plotting tasks. Since I don’t want to introduce an entire ggplot2
dependency to this package, all these plotting functions were developed using base-R plot
. Here I need to acknowledge the significant contribution from Bill Evans (@r2evans on github and SO), who wrote the general spec_plot
function and improved the coding structure of these spec_***
plotting functions.
library(kableExtra)
library(plotly)
library(sparkline)
library(tidyverse)