-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathREADME.Rmd
67 lines (44 loc) · 1.62 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
61
62
63
64
65
66
67
---
output:
md_document:
variant: markdown_github
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
[](https://cran.r-project.org/package=XKCDdata)
[](https://CRAN.R-project.org/package=XKCDdata)
[](https://CRAN.R-project.org/package=XKCDdata)
# XKCDdata
XKCDdata is a little package to get data from individual [xkcd](https://xkcd.com/) comics, written by Randall Munroe.
## Installation
```{r eval = FALSE}
install.packages("XKCDdata")
# or:
# install.packages("devtools")
devtools::install_github("RobertMyles/XKCDdata")
```
## Example:
Let's get data on this comic (it's number 1421):

```{r}
library(XKCDdata)
get_comic(comic = 1421)
```
Or you can get a list of comics pretty easily using purrr, `apply()` or for loops. With purrr, it would be something like:
```{r, eval = FALSE}
# list of comics:
cm <- c(1421, 641, 87, 92)
purrr::map_df(cm, get_comic)
```
Then you could plot it XKCD-style with the [xkcd](http://xkcd.r-forge.r-project.org/) package if you wanted.
## Viewing Comics
Thanks to [Colin](https://github.com/ColinFay), you can view the comics inside your default Viewer (in the Viewer pane if you're on RStudio)! Give it a shot with:
```{r}
print_xkcd(1)
```