Inspired by the “R Memes for Statistical Fiends” page on Facebook—especially Rashnutin’s posts—we will use Leeper’s meme package (https://github.com/leeper/meme) to generate many memes!

Installation

Presently, the meme package does not load from CRAN into R version 3.4, but we can load the package directly from GitHub:

library("devtools")
install_github("leeper/meme")
library("meme")
templates <- meme::get_templates("imgflip")

That last line of code gathers 100 meme templates. We can get a sense of this data by looking at the first template.

templates[[1]]
## $id
## [1] "61579"
## 
## $name
## [1] "One Does Not Simply"
## 
## $url
## [1] "https://i.imgflip.com/1bij.jpg"
## 
## $width
## [1] 568
## 
## $height
## [1] 335
## 
## attr(,"class")
## [1] "meme_template"
## attr(,"site")
## [1] "imgflip"

ImgFlip

Unfortunately, this version of the R code requires login credentials to use the ImgFlip website. If you wish to try out this code, you can input your user name and password in these spots (in your own R session of course):

user <- #type your user name here (as a string)
pass <- #type your password here (as a string)

With the login credential in place, we can now plot the memes. For example,

exampleMeme <- create_meme(templates[[1]], 
                           "top text", 
                           "bottom text",
                           username = user,
                           password = pass)
plot(exampleMeme)