-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
70 lines (47 loc) · 1.78 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
68
69
70
---
output: github_document
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
[![Travis build status](https://travis-ci.org/katiejolly/advicegiveR.svg?branch=master)](https://travis-ci.org/katiejolly/advicegiveR)
# advicegiveR
The goal of advicegiveR is to provide an easy way to make calls to the [advice slip API](http://api.adviceslip.com/). It also provides a fun way to share the advice you get!
## Installation
You can install advicegiveR from github with:
```{r gh-installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("katiejolly/advicegiveR")
library(advicegiveR)
```
## Examples
```{r include = FALSE}
library(advicegiveR)
```
Get a random piece of advice:
```{r}
get_advice()
```
The advice slip API has 216 different outputs (from what I can tell). You can also request a particular piece of advice using the `id` argument. If you get a random piece of advice, the function will tell you what `id` it ended up using so you can find it again.
```{r}
advice <- get_advice(id = 25)
advice
```
Then if you want to print the advice on an image, I have some images ready for you! You can choose from `clouds`, `mountain`, `ocean`, `paper`, `sunset`, or `rainbow`. (You can also use your own image loaded with the `magick` package.)
```{r}
mountain <- load_image(image_name = "mountain")
```
After you've chosen your image, you can put the advice and image together.
```{r image}
print_advice(image = mountain, advice = advice, textcolor = "yellow", size = 40)
```
Then you can save the image you created! A good way comes from the `magick` package:
```{r eval=FALSE}
magick::image_write(...)
```
## Contributing
If you have an idea for this package, feel free to submit an issue or pull request!