knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

Travis build status

advicegiveR

The goal of advicegiveR is to provide an easy way to make calls to the advice slip API. It also provides a fun way to share the advice you get!

Installation

You can install advicegiveR from github with:

# install.packages("devtools")
devtools::install_github("katiejolly/advicegiveR")
library(advicegiveR)

Examples

library(advicegiveR)

Get a random piece of advice:

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.

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.)

mountain <- load_image(image_name = "mountain")

After you've chosen your image, you can put the advice and image together.

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:

magick::image_write(...)

Contributing

If you have an idea for this package, feel free to submit an issue or pull request!



katiejolly/advicegiveR documentation built on May 22, 2019, 11:52 p.m.