Sling messages and warnings with flair
Usage
say(
what = "Hello world!",
by = "cow",
type = NULL,
what_color = NULL,
by_color = what_color,
length = 18,
fortune = NULL,
width = 60,
...
)
think(
what = "Hello world!",
by = "cow",
type = NULL,
what_color = NULL,
by_color = what_color,
length = 18,
fortune = NULL,
width = 60,
...
)Arguments
- what
(character) What do you want to say? See Details.
- by
(character) Who should say or think it? One of: alligator, ant, anxiouscat, bat, bat2, beavis, behindcat, bigcat, blowfish, buffalo, cat, chicken, chuck, clippy, cow, cow_borg, cow_dead, cow_greedy, cow_sleepy, cow_tired, cow_wired, cow_young, daemon, dragon, duck, duckling, egret, endlesshorse, facecat, fish, frog, ghost, goldfish, grumpycat, hypnotoad, longcat, longtailcat, monkey, mushroom, owl, pig, poop, pumpkin, rabbit, rms, shark, shortcat, signbunny, smallcat, snowman, spider, squirrel, squirrel2, stegosaurus, stretchycat, trilobite, turkey, whale, wolf, yoda. Alternatively, use 'random' to have your message spoken by a random character. We use
rlang::arg_match()internally, which does not support partial matching, so you'll get an informative error upon a partial match.- type
(character) One of message (default), warning, print (default in non-interactive mode), or string (returns string). If run in non-interactive mode default type is print, so that output goes to stdout rather than stderr, where messages and warnings go.
- what_color
(character or crayon function) One or more
crayon-suported text color(s) orcrayon style functionto colorwhat. You might trycolors()or?rgbfor ideas. Use "rainbow" for c("red", "orange", "yellow", "green", "blue", "purple").- by_color
(character or crayon function) One or more
crayon-suported text color(s) orcrayon style functionto colorwho. Use "rainbow" forc("red", "orange", "yellow", "green", "blue", "purple"). By default is set to be whatever colorwhat_coloris so you can have the same color for both with less typing.- length
(integer) Length of longcat. Ignored if other animals used.
- fortune
An integer (or number that can be coerced to integer) specifying a fortune from the
fortunespackage - OR a string which is used as a pattern passed togrep()(and a random one is selected upton multiple matches). Passed on to thewhichparameter offortunes::fortune- width
(integer/numeric) width of each line. default: 60
- ...
Further args passed on to
fortunes::fortune()
what
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:
"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 withby = "rms".
by
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
http://knowyourmeme.com/memes/hypnotoad
signbunny: It's not for sure known who invented signbunny, but this article http://www.vox.com/2014/9/18/6331753/sign-bunny-meme-explained thinks they found the first use in this tweet: https://twitter.com/wei_bluebear/status/329101645780770817
trilobite: from http://www.retrojunkie.com/asciiart/animals/dinos.htm (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.
Examples
say()
#>
#> ______________
#> < Hello world! >
#> --------------
#> \
#> \
#>
#> ^__^
#> (oo)\ ________
#> (__)\ )\ /\
#> ||------w|
#> || ||
say("what")
#>
#> ______
#> < what >
#> ------
#> \
#> \
#>
#> ^__^
#> (oo)\ ________
#> (__)\ )\ /\
#> ||------w|
#> || ||
say("time")
#>
#> ____________________________
#> < 2025-10-29 05:43:03.202245 >
#> ----------------------------
#> \
#> \
#>
#> ^__^
#> (oo)\ ________
#> (__)\ )\ /\
#> ||------w|
#> || ||
say("who you callin chicken", "chicken")
#>
#> ________________________
#> < who you callin chicken >
#> ------------------------
#> \
#> \
#> _
#> _/ }
#> `>' \
#> `| \
#> | /'-. .-.
#> \' ';`--' .'
#> \'. `'-./
#> '.`-..-;`
#> `;-..'
#> _| _|
#> /` /` [nosig]
say("ain't that some shit", "poop")
#>
#> ______________________
#> < ain't that some shit >
#> ----------------------
#> \
#> \
#>
#> ( )
#> ( ) (
#> ) _ )
#> ( \_
#> _(_\ \)__
#> (____\ ___)) [nosig]
say("icanhazpdf?", "cat")
#>
#> _____________
#> < icanhazpdf? >
#> -------------
#> \
#> \
#>
#> |\___/|
#> ==) ^Y^ (==
#> \ ^ /
#> )=*=(
#> / \
#> | |
#> /| | | |\
#> \| | |_|/\
#> jgs //_// ___/
#> \_)
say("boo!", "pumpkin")
#>
#> ______
#> < boo! >
#> ------
#> \
#> \
#>
#> ___
#> ___)__|_
#> .-*' '*-,
#> / /| |\ \
#> ; /_| |_\ ;
#> ; |\ /| ;
#> ; | ''--...--'' | ;
#> \ ''---.....--'' /
#> ''*-.,_______,.-*' [nosig]
say("hot diggity", "frog")
#>
#> _____________
#> < hot diggity >
#> -------------
#> \
#> \
#>
#> (.)_(.)
#> _ ( _ ) _
#> / \/`-----'\/ \
#> __\ ( ( ) ) /__
#> ) /\ \._./ /\ (
#> )_/ /|\ /|\ \_( [nosig]
# Vary type of output, default calls message()
say("hell no!")
#>
#> __________
#> < hell no! >
#> ----------
#> \
#> \
#>
#> ^__^
#> (oo)\ ________
#> (__)\ )\ /\
#> ||------w|
#> || ||
say("hell no!", type = "warning")
#> Warning:
#> __________
#> < hell no! >
#> ----------
#> \
#> \
#>
#> ^__^
#> (oo)\ ________
#> (__)\ )\ /\
#> ||------w|
#> || ||
say("hell no!", type = "string")
#> [1] "\n __________ \n< hell no! >\n ---------- \n \\\n \\\n\n ^__^ \n (oo)\\ ________ \n (__)\\ )\\ /\\ \n ||------w|\n || ||"
# The hypnotoad
say(by = "hypnotoad")
#>
#> ______________________________
#> < All Glory to the HYPNO TOAD! >
#> ------------------------------
#> \
#> \
#>
#> ,'``.._ ,'``.
#> :,--._:)\,:,._,.:
#> :`--,'' :`...';\
#> `,' `---' `.
#> / :
#> / \
#> ,' :\.___,-.
#> `...,---'``````-..._ |: \
#> ( ) ;: ) \ _,-.
#> `. ( // `' \
#> : `.// ) ) , ;
#> ,-|`. _,'/ ) ) ,' ,'
#> ( :`.`-..____..=:.-': . _,' ,'
#> `,'\ ``--....-)=' `._, \ ,') _ '``._
#> _.-/ _ `. (_) / )' ; / \ \`-.'
#> `--( `-:`. `' ___..' _,-' |/ `.)
#> `-. `.`.``-----``--, .'
#> |/`.\`' ,','); SSt
#> ` (/ (/
# Trilobite
say(by = "trilobite")
#>
#> ______________
#> < Hello world! >
#> --------------
#> \
#> \
#>
#> _____
#> .'` ,-. `'.
#> / ([ ]) \
#> /.-""`(`)`""-.\
#> <'```(.)```'>
#> <'```(.)```'>
#> <'``(.)``'>
#> sk <``\_/``>
#> `'---'`
# Shark
say("Q: What do you call a solitary shark\nA: A lone shark", by = "shark")
#>
#> ______________________________________________________
#> < Q: What do you call a solitary shark A: A lone shark >
#> ------------------------------------------------------
#> \
#> \
#>
#> /""-._
#> . '-,
#> : '',
#> ; * '.
#> ' * () '.
#> \ \
#> \ _.---.._ '.
#> : .' _.--''-'' \ ,'
#> .._ '/.' . ;
#> ; `-. , \'
#> ; `, ; ._\
#> ; \ _,-' ''--._
#> : \_,-' '-._
#> \ ,-' . '-._
#> .' __.-''; \...,__ '.
#> .' _,-' \ \ ''--.,__ '\
#> / _,--' ; \ ; \^.}
#> ;_,-' ) \ )\ ) ;
#> / \/ \_.,-' ;
#> / ;
#> ,-' _,-'''-. ,-., ; PFA
#> ,-' _.-' \ / |/'-._...--'
#> :--`` )/
#> '
# Buffalo
say("Q: What do you call a single buffalo?\nA: A buffalonely", by = "buffalo")
#>
#> ________________________________________________________
#> < Q: What do you call a single buffalo? A: A buffalonely >
#> --------------------------------------------------------
#> \
#> \
#>
#> _.-````'-,_
#> _,.,_ ,-'` `'-.,_
#> /) ( '``-.
#> (( ) ) `\
#> \) (_/ )\
#> | /) ' ,' / \
#> `\ ^' ' ( / ))
#> | _/\ , / ,,`\ ( "`
#> \Y, | \ \ | ````| / \_ \
#> `)_/ \ \ ) ( > ( >
#> \( \( |/ |/
#> mic & dwb /_(/_( /_( /_(
# Using fortunes
library(fortunes)
say(what = "fortune")
#>
#> ________________________________________________________
#> / If you imagine that this pen is Trellis, then Lattice \
#> | is not this pen. Paul Murrell on the difference of |
#> | Lattice (which eventually was called grid) and Trellis |
#> \ DSC 2001, Wien March 2001 /
#> --------------------------------------------------------
#> \
#> \
#>
#> ^__^
#> (oo)\ ________
#> (__)\ )\ /\
#> ||------w|
#> || ||
## you don't have to pass anything to the `what` parameter if `fortune` is
## not null
say("fortune", "spider")
#>
#> _________________________________________________________
#> / [Listing original copyright holders in R packages is] \
#> | especially useful if there are areas of doubt and |
#> | uncertainty (eg code published on ftp sites before |
#> | people worried about licenses), since it at least gives |
#> | you rigidly defined areas of doubt and uncertainty.[5] |
#> | [5] Adams D, (1978) Hitchhiker's Guide. BBC Radio. |
#> | Thomas Lumley in a discussion about copyright vs. |
#> \ licenses R-devel January 2010 /
#> ---------------------------------------------------------
#> \
#> \
#>
#> |
#> |
#> |
#> __
#> | / \ |
#> \_\\ //_/
#> .'/()\'.
#> \\ // [nosig]
say("fortune", "facecat")
#>
#> ______________________________________________________
#> / Ah, so that's why my report of a bug in the \
#> | RCheapViagra package didn't get through.... Barry |
#> | Rowlingson after Peter Dalgaard announced a new spam |
#> \ filter for R-bugs R-devel January 2004 /
#> ------------------------------------------------------
#> \
#> \
#>
#> /\ /\
#> (O o)
#> =(:^:)=
#> U [nosig]
say("fortune", "behindcat")
#>
#> _________________________________________________________
#> / This should be FAQ 0.0. No other thing is asked as \
#> | frequently as this. This is the FAQest of all FAQs, and |
#> | a mother of all FAQs. Jari Oksanen answering yet |
#> | another question related to FAQ 7.31 R-help February |
#> \ 2013 /
#> ---------------------------------------------------------
#> \
#> \
#>
#> |\___/|
#> ) (
#> =\ /=
#> )===(
#> / \
#> | |
#> / \
#> \ /
#> jgs \__ _/
#> ( (
#> ) )
#> (_(
say("fortune", "smallcat")
#>
#> ______________________________________________________
#> / Firstly, don't call your matrix 'matrix'. Would you \
#> | call your dog 'dog'? Anyway, it might clash with the |
#> | function 'matrix'. Barry Rowlingson R-help October |
#> \ 2004 /
#> ------------------------------------------------------
#> \
#> \
#>
#> /\_/\
#> ( o.o )
#> > ^ < [nosig]
say("fortune", "monkey")
#>
#> ________________________________________________________
#> / I'm really curious to know why the "two types" of sum \
#> | of squares are called "Type I" and "Type III"! This is |
#> | a very common misconception, particularly among SAS |
#> | users who have been fed this nonsense quite often for |
#> | all their professional lives. Fortunately the reality |
#> | is much simpler. There is, by any sensible reckoning, |
#> | only ONE type of sum of squares, and it always |
#> | represents an improvement sum of squares of the outer |
#> | (or alternative) model over the inner (or null |
#> | hypothesis) model. What the SAS highly dubious |
#> | classification of sums of squares does is to encourage |
#> | users to concentrate on the null hypothesis model and |
#> | to forget about the alternative. This is always a very |
#> | bad idea and not surprisingly it can lead to |
#> | nonsensical tests, as in the test it provides for main |
#> | effects "even in the presence of interactions", |
#> | something which beggars definition, let alone belief. |
#> \ Bill Venables R-help November 2000 /
#> --------------------------------------------------------
#> \
#> \
#>
#> .="=.
#> _/.-.-.\_ _
#> ( ( o o ) ) ))
#> |/ " \| //
#> \'---'/ //
#> jgs /`"""`\\ ((
#> / /_,_\ \\ \\
#> \_\_'__/ \ ))
#> /` /`~\ |//
#> / / \ /
#> ,--`,--'\/\ /
#> '-- "--' '--'
say("fortune", "egret")
#>
#> _______________________________________________________
#> / Please bear with a poor newbee, who might be doing \
#> | everything backwards (I was brought up in pure math). |
#> \ Thomas Poulsen R-help May 2004 /
#> -------------------------------------------------------
#> \
#> \
#>
#> _,
#> -==<' `
#> ) /
#> / (_.
#> | ,-,`\
#> \\ \ \
#> `\, \ \
#> ||\ \`|,
#> jgs _|| `=`-'
#> ~~`~`
say(fortune = 10)
#>
#> _______________________________________________________
#> / Overall, SAS is about 11 years behind R and S-Plus in \
#> | statistical capabilities (last year it was about 10 |
#> | years behind) in my estimation. Frank Harrell (SAS |
#> \ User, 1969-1991) R-help September 2003 /
#> -------------------------------------------------------
#> \
#> \
#>
#> ^__^
#> (oo)\ ________
#> (__)\ )\ /\
#> ||------w|
#> || ||
say(fortune = 100)
#>
#> _________________________________________________________
#> / I'm not sure I'd trust any computer recommendation from \
#> | 1976, no matter how famous the authors are. Peter |
#> | Dalgaard after Samuel Edward Kemp cited a |
#> | recommendation about nonlinear least squares computer |
#> \ programs from 'Box-Jenkins, 1976' R-help January 2005 /
#> ---------------------------------------------------------
#> \
#> \
#>
#> ^__^
#> (oo)\ ________
#> (__)\ )\ /\
#> ||------w|
#> || ||
say(fortune = "whatever")
#>
#> _________________________________________________________
#> / Tom Backer Johnsen: I have just started looking at R, \
#> | and are getting more and more irritated at myself for |
#> | not having done that before. However, one of the things |
#> | I have not found in the documentation is some way of |
#> | preparing output from R for convenient formatting into |
#> | something like MS Word. Barry Rowlingson: Well whatever |
#> | you do, don't start looking at LaTeX, because that will |
#> | get you even more irritated at yourself for not having |
#> | done it before. Tom Backer Johnsen and Barry |
#> \ Rowlingson R-help February 2006 /
#> ---------------------------------------------------------
#> \
#> \
#>
#> ^__^
#> (oo)\ ________
#> (__)\ )\ /\
#> ||------w|
#> || ||
say(fortune = 7)
#>
#> ____________________________________________________
#> / What we have is nice, but we need something very \
#> | different. Robert Gentleman Statistical Computing |
#> \ 2003, Reisensburg June 2003 /
#> ----------------------------------------------------
#> \
#> \
#>
#> ^__^
#> (oo)\ ________
#> (__)\ )\ /\
#> ||------w|
#> || ||
say(fortune = 45)
#>
#> _________________________________________________________
#> / It seems to me against the spirit of Open Source \
#> | software to attempt to monitor distribution. We could |
#> | ask R to 'call home' on first use (in the way e.g. pine |
#> | does) but I suspect many users would find that |
#> | objectionable. Brian D. Ripley in a discussion about |
#> | trying to estimate the number of R users R-help April |
#> \ 2004 /
#> ---------------------------------------------------------
#> \
#> \
#>
#> ^__^
#> (oo)\ ________
#> (__)\ )\ /\
#> ||------w|
#> || ||
# Clippy
say(fortune = 59, by = "clippy")
#>
#> ________________________________________________________
#> / Let's not kid ourselves: the most widely used piece of \
#> | software for statistics is Excel. Brian D. Ripley |
#> | 'Statistical Methods Need Software: A View of |
#> | Statistical Computing' Opening lecture RSS 2002, |
#> \ Plymouth September 2002 /
#> --------------------------------------------------------
#> \
#> \
#>
#> _
#> / \
#> | |
#> @ @
#> || ||
#> || ||
#> |\_/|
#> \___/ GB
library(rmsfact)
say("rms", "rms")
#>
#> _______________________________________
#> < Richard Stallman can touch MC Hammer. >
#> ---------------------------------------
#> \
#> \
#>
#> @@@@@@ @
#> @@@@ @@
#> @@@@ = = @@
#> @@@ @ _ _ @@
#> @@@ @(0)|(0) @@
#> @@@@ ~ | ~ @@
#> @@@ @ (o1o) @@
#> @@@ ####### @
#> @@@ ##{+++}## @@
#> @@@@@ ## ##### ## @@@@
#> @@@@@#############@@@@
#> @@@@@@@###########@@@@@@
#> @@@@@@@#############@@@@@
#> @@@@@@@### ## ### ###@@@@
#> @ @ @ @ @
#> @ @