say: Sling messages and warnings with flair

View source: R/say.r

sayR Documentation

Sling messages and warnings with flair


Sling messages and warnings with flair


  what = "Hello world!",
  by = "cat",
  type = NULL,
  what_color = NULL,
  by_color = NULL,
  length = 18,
  fortune = NULL,



(character) What do you want to say? See Details.


(character) Type of thing, one of cow, chicken, chuck, clippy, poop, bigcat, ant, pumpkin, ghost, spider, rabbit, pig, snowman, frog, hypnotoad, shortcat, longcat, fish, signbunny, facecat, behindcat, stretchycat, anxiouscat, longtailcat, cat, trilobite, shark, buffalo, grumpycat, smallcat, yoda, mushroom, endlesshorse, bat, bat2, turkey, monkey, daemon, egret, duckling, duck, owl, squirrel, squirrel2, goldfish, alligator, stegosaurus, whale, wolf, or rms for Richard Stallman. Alternatively, use "random" to have your message spoken by a random character. We use match.arg() internally, so you can use unique parts of words that don't conflict with others, like "g" for "ghost" because there's no other animal that starts with "g".


(character) One of message (default), warning, print (default in non-interactive mode), or string (returns string). If multiple colors are supplied to what_color or by_color, type cannot be warning. (This is a limitation of the multicolor packcage :/.) If run in non-interactive mode default type is print, so that output goes to stdout rather than stderr, where messages and warnings go.


(character or crayon function) One or more crayon-suported text color(s) or crayon style function to color what. You might try colors() or ?rgb for ideas. Use "rainbow" for c("red", "orange", "yellow", "green", "blue", "purple").


(character or crayon function) One or more crayon-suported text color(s) or crayon style function to color who. Use "rainbow" for c("red", "orange", "yellow", "green", "blue", "purple")


(integer) Length of longcat. Ignored if other animals used.


An integer specifying the row number of Alternatively which can be a character and grep is used to try to find a suitable row.


Further args passed on to fortunes::fortune()


You can put in any phrase you like to the what parameter, OR you can type in one of a few special phrases that do particular things. They are:

  • "catfact": A random cat fact from

  • "fortune": A random quote from an R coder, from fortunes library

  • "time": Print the current time

  • "rms": Prints a random 'fact' about Richard Stallman from the rmsfact::rmsfact() package. Best paired with by = "rms".

  • The fillerama API was an option ("arresteddevelopment", "doctorwho", "dexter", "futurama", "holygrail", "simpsons", "starwars", "loremipsum"), a text generator with quotes from shows and movies. However, the API is currently down so you cannot use this option anymore.


Note that if you choose by='hypnotoad' the quote is forced to be, as you could imagine, 'All Glory to the HYPNO TOAD!'. For reference see

signbunny: It's not for sure known who invented signbunny, but this article thinks they found the first use in this tweet:

trilobite: from (site down though)

Note to Windows users: there are some animals (shortcat, longcat, fish, signbunny, stretchycat, anxiouscat, longtailcat, grumpycat, mushroom) that are not available because they use non-ASCII characters that don't display properly in R on Windows.



say("who you callin chicken", "chicken")
say("ain't that some shit", "poop")
say("icanhazpdf?", "cat")
say("boo!", "pumpkin")
say("hot diggity", "frog")
say("fortune", "spider")
say("fortune", "facecat")
say("fortune", "behindcat")
say("fortune", "smallcat")
say("fortune", "monkey")
say("fortune", "egret")
say("rms", "rms")

# Vary type of output, default calls message()
say("hell no!")
say("hell no!", type="warning")
say("hell no!", type="string")

# Using fortunes
## you don't have to pass anything to the `what` parameter if `fortune` is
## not null

# Using catfacts
# say("catfact", "cat")

# The hypnotoad

# Trilobite

# Shark
say('Q: What do you call a solitary shark\nA: A lone shark', by='shark')

# Buffalo
say('Q: What do you call a single buffalo?\nA: A buffalonely', by='buffalo')

# Clippy
say(fortune=59, by="clippy")

cowsay documentation built on Nov. 3, 2023, 1:16 a.m.