forked from leeper/meme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
61 lines (41 loc) · 2.41 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Meme Generation in R
[![Build Status](https://travis-ci.org/leeper/meme.png?branch=master)](https://travis-ci.org/leeper/meme)
According to [Wikipedia](http://en.wikipedia.org/wiki/Internet_meme):
>An Internet meme (/'mi?m/ meem) is an activity, concept, catchphrase or piece of media which spreads, often as mimicry, from person to person via the Internet.
**meme** is an R package that connects with several online image generators to create internet memes, which can then be loaded into R, plotted, and saved locally.
## Installation ##
At some point **meme** will be [available on CRAN](http://cran.r-project.org/web/packages/meme/index.html) and installed from within R from your favorite CRAN mirror:
```
install.packages("meme")
```
The latest development version, available here, can be installed directly using Hadley Wickham's [devtools](http://cran.r-project.org/web/packages/devtools/index.html) package:
```
if(!require("devtools")) install.packages("devtools")
library("devtools")
install_github("leeper/meme")
```
## Examples ##
Here are some simple examples using the package and the default [memecaptain](http://memecaptain.com/) generator. To get started, you can grab some image templates from one of the meme generator sites. We'll use memecaptain because it doesn't require a username and password.
```{r templates}
library("meme")
templates <- get_templates("memecaptain")
```
You can use the `plot.meme_template` method to plot all templates from a given site to help you figure out which one you want to use. Here's some code to do it:
```
par( mfrow = n2mfrow(length(templates)), mar=rep(0,4), mgp=rep(0,3))
invisible(lapply(templates, plot))
```
Here are some example memes. These could probably be better, so pull requests are welcome!
```{r allthethings, fig.width=5, fig.height=5, fig.path='inst/figures/'}
plot(allthethings <- create_meme(templates[[2]], "Code", "all the things!"))
```
```{r simply, fig.width=6, fig.height=5, fig.path='inst/figures/'}
plot(simply <- create_meme(templates[[10]], "One does not simply", "reshape data from wide to long"))
```
```{r yuno, fig.width=5, fig.height=5, fig.path='inst/figures/'}
plot(yuno <- create_meme(templates[[55]], "R CMD check", "y u no work?"))
```
```{r grumpy, fig.width=5, fig.height=7, fig.path='inst/figures/'}
u <- "http://img4.wikia.nocookie.net/__cb20131009153844/villains/images/f/f6/Grumpy_Cat.jpg"
plot(grumpy <- create_meme(u, "", "R-help"))
```