Search code examples
rioslides

How to Create Colourful ioslides


I crave to create colourful ioslides that will look like this picture:

enter image description here

Here is what I tried:

---
title: |
  "R on Twiter"
  .
author: "Daniel James"
#date: "`r Sys.Date()`"
output: 
  ioslides_presentation:
  toc: true
code_folding: "show"
---


```{r setup, include=F}
knitr::opts_chunk$set(echo = TRUE)
```

## R Code
```{r rfortwiter, include = TRUE}
library(dplyr)

# data to use
df <- head(mtcars)

# in pipe workflow

# pulling a single column without 'pull()'
df %>% .$cyl
#> [1] 6 6 4 6 8 6

# pulling a single column with 'pull()' 
df %>% pull(cyl)
#> [1] 6 6 4 6 8 6
```

I actually got the image on Twitter @rfunctionaday and will like to produce a stand-alone slide as colourful as this in order to showcase my new R package on social media.


Solution

  • Usually that type of images are generated by using Carbon (https://carbon.now.sh/), or similar tools (eg. silicon: https://github.com/Aloxaf/silicon).

    An alternative, using R, is the carbonate package (https://yonicd.github.io/carbonate/), which will read the code from a file, submit it to Carbon, and save it to an image. You can then add that image to your Rmarkdown document.