Type: Package
Title: Return a Random Dad Joke
Version: 1.0.2
URL: https://github.com/jhollist/dadjokeapi/
BugReports: https://github.com/jhollist/dadjokeapi/issues/
Maintainer: Jeffrey Hollister <hollister.jeff@epa.gov>
Description: What is funnier than a dad joke? A dad joke in R! This package utilizes the API for https://icanhazdadjoke.com and returns dad jokes from several API endpoints.
License: MIT + file LICENSE
Depends: R (≥ 3.5.0)
Imports: httr, beepr, curl, dplyr, png
LazyData: true
RoxygenNote: 7.1.1
Suggests: testthat, mockery
NeedsCompilation: no
Packaged: 2021-02-25 18:28:38 UTC; JHollist
Author: Jeffrey Hollister [aut, cre], Antoine Bichat [ctb], Brett Langdon [cph]
Repository: CRAN
Date/Publication: 2021-03-01 09:20:09 UTC

Function to return random dad joke

Description

This function returns a random dad joke(s) from https://icanhazdadjoke.com. as a message and invisibly as a character.

Usage

groan(sting = TRUE)

Arguments

sting

Plays a joke sting after the joke. Sound from https://archive.org/details/Rimshot_254

Value

Invisibly returns a two item list with the first item holding the joke as a character and the second item containing the joke id as a character.

Examples

groan(sting = FALSE)

Function to return a specific dad joke

Description

This function returns a specific dad joke from https://icanhazdadjoke.com using its dad joke ID.

Usage

groan_id(joke_id)

Arguments

joke_id

A specific dad joke ID to return

Value

Returns a two item list with the first item holding the joke as a character and the second item containing the joke id as a character.

Examples

groan_id("GlGBIY0wAAd")

Function to return a specific dad joke as an image

Description

This function returns a specific dad joke as a png from https://icanhazdadjoke.com using its dad joke ID.

Usage

groan_image(joke_id)

Arguments

joke_id

A specific dad joke ID to return

Value

Returns a png array from readPNG.

Examples

joke_png <- groan_image("GlGBIY0wAAd")

Description

This function returns a specific dad joke as a png from https://icanhazdadjoke.com using its dad joke ID.

Usage

groan_search(term)

Arguments

term

A term to search https://icanhazdadjoke.com

Value

Returns a tibble of joke and joke id for jokes that contain the search term.

Examples

groan_search(term = "cat")