blob: 80a25011bead776933191d2a83ea74b2d588c588 [file] [log] [blame]
Hao Zhud4f54982020-10-07 16:26:35 -04001---
2title: "In-table Plots"
3output:
4 html_document:
5 theme: cosmo
6---
7
8```{r, include=F}
9knitr::opts_chunk$set(warning = F, message = F)
10```
11
Hao Zhu75e2ad02020-10-21 22:09:53 -040012Sometimes 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`.
Hao Zhud4f54982020-10-07 16:26:35 -040013
Hao Zhu75e2ad02020-10-21 22:09:53 -040014In 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.
Hao Zhud4f54982020-10-07 16:26:35 -040015
16```{r}
17library(kableExtra)
18library(plotly)
19library(sparkline)
20library(tidyverse)
21```
22
Hao Zhu75e2ad02020-10-21 22:09:53 -040023## Summary Stats Table
24
25```{r}
26
27```
28
29### kableExtra built-in
30
31```{r}
32
33```
34
Hao Zhud4f54982020-10-07 16:26:35 -040035