Skip to content
Print a random joke every time you start R
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
inst/extdata
man
.Rbuildignore
.gitignore
DESCRIPTION
NAMESPACE
README.Rmd
README.md
jokeR.Rproj

README.md

jokeR

Installation

# Install development version from GitHub
# install.packages("devtools")
devtools::install_github("AQLT/jokeR")

Usage

To print a random joke you can use the function random_joke():

library(jokeR)
random_joke()

You can also specify from which database you want a random joke and on which categories (use joke_categories() to check the available ones). For example to only have jokes religious and animal jokes:

random_joke(categories = c("Animal", "Animals", "Religious"))

To print a message each time you open your session the most simple is to edit your Rprofile.site file. If R is installed in C:\Program Files\R\R-n.n.n this file will be located in the C:\Program Files\R\R-n.n.n\etc directory. You can also use the function:

edit_rprofile.site()

Then, if you use RStudio, you can add the following command to print a message each time you open RStudio (thanks davidgohel for the tip!):

setHook("rstudio.sessionInit", function(newSession) {
  if (newSession){
    jokeR::random_joke()
  }
}, action = "append")

Otherwise you can also change the .First() function:

.First <- function() {
  jokeR::random_joke()
}

Databases

For the moment the database are from https://github.com/taivop/joke-dataset (jokes from stupidstuff and wocka).

Futur developments

Have more and smaller databases on various topics: jokes, citations, poems, etc.
Add category argument to jokes.

You can’t perform that action at this time.