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 function
to colorwhat
. You might trycolors()
or?rgb
for 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 function
to colorwho
. Use "rainbow" forc("red", "orange", "yellow", "green", "blue", "purple")
. By default is set to be whatever colorwhat_color
is 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
fortunes
package - OR a string which is used as a pattern passed togrep()
(and a random one is selected upton multiple matches). Passed on to thewhich
parameter 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:
"catfact": A random cat fact from https://catfact.ninja
"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-03-29 00:22:52.541952 >
#> ----------------------------
#> \
#> \
#>
#> ^__^
#> (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")
#>
#> ________________________________________________________
#> / 1st mail: One of the reasons that SAM is popular, is \
#> | that it is popular (i.e. since everyone has heard of |
#> | it, it makes reviewers happy). So, it would be nice to |
#> | be able to point to publications in good journals so |
#> | that reviewers will be comfortable. (I personally, am |
#> | quite comfortable with SAM). 2nd mail: Oops, must have |
#> | been a Freudian slip. Actually, I am not perfectly |
#> | comfortable with SAM. But I am quite comfortable with |
#> | limma. Naomi Altman answering the question whether |
#> | anyone had published data using limma for microarray |
#> \ analysis bioconductor June 2004 /
#> --------------------------------------------------------
#> \
#> \
#>
#> ^__^
#> (oo)\ ________
#> (__)\ )\ /\
#> ||------w|
#> || ||
## you don't have to pass anything to the `what` parameter if `fortune` is
## not null
say("fortune", "spider")
#>
#> _________________________________________________________
#> / The existence of a method is not a sufficient reason to \
#> | use that method. Jari Oksanen about relative |
#> | advantages of several multivariate analysis methods |
#> \ R-SIG-Ecology November 2013 /
#> ---------------------------------------------------------
#> \
#> \
#>
#> |
#> |
#> |
#> __
#> | / \ |
#> \_\\ //_/
#> .'/()\'.
#> \\ // [nosig]
say("fortune", "facecat")
#>
#> _________________________________________________________
#> / Seldom are prizes, credit, and gratitude given, else \
#> | Brian would be drowning in them. Anthony Rossini about |
#> \ the merits of implementing software R-help May 2004 /
#> ---------------------------------------------------------
#> \
#> \
#>
#> /\ /\
#> (O o)
#> =(:^:)=
#> U [nosig]
say("fortune", "behindcat")
#>
#> _________________________________________________________
#> / 3-D bar plots are an abomination. Just because Excel \
#> | can do them doesn't mean you should. (Dismount pulpit). |
#> \ Berton Gunter R-help October 2007 /
#> ---------------------------------------------------------
#> \
#> \
#>
#> |\___/|
#> ) (
#> =\ /=
#> )===(
#> / \
#> | |
#> / \
#> \ /
#> jgs \__ _/
#> ( (
#> ) )
#> (_(
say("fortune", "smallcat")
#>
#> _________________________________________________________
#> / If anything, there should be a Law: Thou Shalt Not Even \
#> | Think Of Producing A Graph That Looks Like Anything |
#> | From A Spreadsheet. Ted Harding in a discussion about |
#> \ producing graphics R-help August 2007 /
#> ---------------------------------------------------------
#> \
#> \
#>
#> /\_/\
#> ( o.o )
#> > ^ < [nosig]
say("fortune", "monkey")
#>
#> ________________________________________________________
#> / 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 /
#> --------------------------------------------------------
#> \
#> \
#>
#> .="=.
#> _/.-.-.\_ _
#> ( ( o o ) ) ))
#> |/ " \| //
#> \'---'/ //
#> jgs /`"""`\\ ((
#> / /_,_\ \\ \\
#> \_\_'__/ \ ))
#> /` /`~\ |//
#> / / \ /
#> ,--`,--'\/\ /
#> '-- "--' '--'
say("fortune", "egret")
#>
#> _________________________________________________________
#> / [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 /
#> ---------------------------------------------------------
#> \
#> \
#>
#> _,
#> -==<' `
#> ) /
#> / (_.
#> | ,-,`\
#> \\ \ \
#> `\, \ \
#> ||\ \`|,
#> 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")
#>
#> _________________________________________________________
#> / Justin: Is there a function that just does whatever I'm \
#> | thinking (aka whatever my homework question is...)? |
#> | Joshua Ulrich: That's the magic_pony function. Justin |
#> \ and Joshua Ulrich stackoverflow.com June 2013 /
#> ---------------------------------------------------------
#> \
#> \
#>
#> ^__^
#> (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 is licensed under GPL, so you can \
#> | clone him and redistribute copies so you can help your |
#> | neighbor. For example a version that take a bath more |
#> \ often. /
#> --------------------------------------------------------
#> \
#> \
#>
#> @@@@@@ @
#> @@@@ @@
#> @@@@ = = @@
#> @@@ @ _ _ @@
#> @@@ @(0)|(0) @@
#> @@@@ ~ | ~ @@
#> @@@ @ (o1o) @@
#> @@@ ####### @
#> @@@ ##{+++}## @@
#> @@@@@ ## ##### ## @@@@
#> @@@@@#############@@@@
#> @@@@@@@###########@@@@@@
#> @@@@@@@#############@@@@@
#> @@@@@@@### ## ### ###@@@@
#> @ @ @ @ @
#> @ @
# Using the catfacts API
library(jsonlite)
say("catfact", "cat")
#>
#> _________________________________________________________
#> /Spanish-Jewish folklore recounts that Adam’s first \
#> | wife, Lilith, became a black vampire cat, sucking the |
#> | blood from sleeping babies. This may be the root of the |
#> | superstition that a cat will smother a sleeping baby or |
#> \suck out the child’s breath. /
#> ---------------------------------------------------------
#> \
#> \
#>
#> |\___/|
#> ==) ^Y^ (==
#> \ ^ /
#> )=*=(
#> / \
#> | |
#> /| | | |\
#> \| | |_|/\
#> jgs //_// ___/
#> \_)