say: Sling messages and warnings with flair

Description Usage Arguments what by Examples

View source: R/say.r

Description

Sling messages and warnings with flair

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
say(
  what = "Hello world!",
  by = "cat",
  type = NULL,
  what_color = NULL,
  by_color = NULL,
  length = 18,
  fortune = NULL,
  ...
)

Arguments

what

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

by

(character) Type of thing, one of cow, chicken, poop, cat, facecat, bigcat, longcat, shortcat, behindcat, longtailcat, anxiouscat, grumpycat, smallcat, ant, pumpkin, ghost, spider, rabbit, pig, snowman, frog, hypnotoad, signbunny, stretchycat, fish, trilobite, shark, buffalo, clippy, mushroom, monkey, egret, 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".

type

(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.

what_color

(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").

by_color

(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")

length

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

fortune

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

...

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:

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
say()
say("what")
say("meow", "cat", what_color = "blue")
say('time')
say('time', "poop", by_color = "cyan", what_color = "pink")

library(jsonlite)
say("hello world",
    by = "hypnotoad",
    what_color = c("royalblue1", "tomato2"),
    by_color = c("rainbow", "rainbow"))
say("whats up",
    what_color = crayon::cyan$bgMagenta,
    by_color = c("salmon1", "springgreen"))

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
say(what="fortune")
## you don't have to pass anything to the `what` parameter if `fortune` is
## not null
say(fortune=10)
say(fortune=100)
say(fortune='whatever')
say(fortune=7)
say(fortune=45)

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

# The hypnotoad
say(by="hypnotoad")

# Trilobite
say(by='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")

Example output

Colors cannot be applied in this environment :( Try using a terminal or RStudio.

 -------------- 
Hello world! 
 --------------
    \
      \
        \
            |\___/|
          ==) ^Y^ (==
            \  ^  /
             )=*=(
            /     \
            |     |
           /| | | |\
           \| | |_|/\
      jgs  //_// ___/
               \_)
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.

 -------------- 
what 
 --------------
    \
      \
        \
            |\___/|
          ==) ^Y^ (==
            \  ^  /
             )=*=(
            /     \
            |     |
           /| | | |\
           \| | |_|/\
      jgs  //_// ___/
               \_)
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.

 -------------- 
meow 
 --------------
    \
      \
        \
            |\___/|
          ==) ^Y^ (==
            \  ^  /
             )=*=(
            /     \
            |     |
           /| | | |\
           \| | |_|/\
      jgs  //_// ___/
               \_)
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.

 -------------- 
2020-08-29 18:13:24 
 --------------
    \
      \
        \
            |\___/|
          ==) ^Y^ (==
            \  ^  /
             )=*=(
            /     \
            |     |
           /| | | |\
           \| | |_|/\
      jgs  //_// ___/
               \_)
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.


 ----- 
2020-08-29 18:13:24 
 ------ 
    \   
     \
     (   )
  (   ) (
   ) _   )
    ( \_
  _(_\ \)__
 (____\ ___)) [nosig]
Colors cannot be applied in this environment :( Try using a terminal or RStudio.


 ----- 
hello world 
 ------
    \          ,'``.._   ,'``.
     \        :,--._:)\,:,._,.:
      \       :`--,''   :`...';\
               `,'       `---'  `.
               /                 :
              /                   \
            ,'                     :\.___,-.
           `...,---'``````-..._    |:       \
             (                 )   ;:    )   \  _,-.
              `.              (   //          `'    \
               :               `.//  )      )     , ;
             ,-|`.            _,'/       )    ) ,' ,'
            (  :`.`-..____..=:.-':     .     _,' ,'
             `,'\ ``--....-)='    `._,  \  ,') _ '``._
          _.-/ _ `.       (_)      /     )' ; / \ \`-.'
         `--(   `-:`.     `' ___..'  _,-'   |/   `.)
             `-. `.`.``-----``--,  .'
               |/`.\`'        ,','); SSt
                   `         (/  (/
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.

 -------------- 
whats up 
 --------------
    \
      \
        \
            |\___/|
          ==) ^Y^ (==
            \  ^  /
             )=*=(
            /     \
            |     |
           /| | | |\
           \| | |_|/\
      jgs  //_// ___/
               \_)
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.


 ----- 
who you callin chicken 
 ------ 
    \   
     \
         _
       _/ }
      `>' \
      `|   \
       |   /'-.     .-.
        \'     ';`--' .'
         \'.    `'-./
          '.`-..-;`
            `;-..'
            _| _|
            /` /` [nosig]
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.


 ----- 
ain't that some shit 
 ------ 
    \   
     \
     (   )
  (   ) (
   ) _   )
    ( \_
  _(_\ \)__
 (____\ ___)) [nosig]
Colors cannot be applied in this environment :( Try using a terminal or RStudio.

 -------------- 
icanhazpdf? 
 --------------
    \
      \
        \
            |\___/|
          ==) ^Y^ (==
            \  ^  /
             )=*=(
            /     \
            |     |
           /| | | |\
           \| | |_|/\
      jgs  //_// ___/
               \_)
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.


 ----- 
boo! 
 ------ 
    \   
     \
                  ___
               ___)__|_
          .-*'          '*-,
         /      /|   |\     \
        ;      /_|   |_\     ;
        ;   |\           /|  ;
        ;   | ''--...--'' |  ;
         \  ''---.....--''  /
          ''*-.,_______,.-*'  [nosig]
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.


 ----- 
hot diggity 
 ------ 
    \   
     \
        (.)_(.)
     _ (   _   ) _
    / \/`-----'\/ \
  __\ ( (     ) ) /__
  )   /\ \._./ /\   (
   )_/ /|\   /|\ \_(  [nosig]
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.


 ----- 
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 
 ------ 
    \   
     \
              |
              |
              |
             __
          | /  \ |
         \_\\  //_/
          .'/()\'.
           \\  //  [nosig]
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.

 -------------- 
I would heed the warnings and diagnostics. They are there for a reason. The Ostrich algorithm does not help you.
 Dirk Eddelbuettel
 in reply to a questioner who said he had not run R CMD check because he suspected other problems would be found
 Stackoverflow
 November 2013 
 --------------
    \
      \
         /\ /\
         (O o)
        =(:^:)=
           U      [nosig]
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.

 -------------- 
Contrary to popular belief the speed of R's interpreter is rarely the limiting factor to R's speed. People treating R like C is typically the limiting factor. You have vector operations, USE THEM.
 Byron Ellis
 R-help
 October 2005 
 --------------
      \
        \
          \
            |\___/|
            )     (
           =\     /=
             )===(
            /     \
            |     |
           /       \
           \       /
      jgs   \__  _/
              ( (
               ) )
              (_(
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.

   
 -------------- 
Jim Gustafsson: I would like to put my SAS-code into R. Could I do that, if yes, how?
Frank Harrell: Just reverse the procedure you use when you put R code into SAS. ;)
 Jim Gustafsson and Frank Harrell
 R-help
 February 2004 
 --------------
    \
     \
      \
         /\_/\
        ( o.o )
         > ^ <      [nosig]


Colors cannot be applied in this environment :( Try using a terminal or RStudio.


 ------------- 
When a Certain Guru rips strips off people (God knows he's done it to me often enough) on this list, there's a damned good reason for it.
 Rolf Turner
 in a discussion about whether a friendly mailing list with more 'customer service' attitude than R-help was needed
 R-help
 December 2003 
 -------------- 
              \   
               \  
                \

                  .="=.
                _/.-.-.\_     _
               ( ( o o ) )    ))
                |/  "  \|    //
                 \'---'/    //
           jgs   /`"""`\\  ((
                / /_,_\ \\  \\
                \_\_'__/  \  ))
                /`  /`~\   |//
               /   /    \  /
          ,--`,--'\/\    /
          '-- "--'  '--'

Colors cannot be applied in this environment :( Try using a terminal or RStudio.

 ----- 
Ivo Welch: Thanks. I will put in a suggestion that the docs refer to q() in 'see also' for 'stop'.
Brian D. Ripley: I don't think anyone else is confusing 'exit' with 'stop', though. I hope you don't when driving ....
 Ivo Welch and Brian D. Ripley
 R-help
 March 2004 
 ------ 
    \   
     \  
      \
       \   _,
      -==<' `
          ) /
         / (_.
        |  ,-,`\
         \\   \ \
          `\,  \ \
           ||\  \`|,
 jgs      _|| `=`-'
         ~~`~`

Colors cannot be applied in this environment :( Try using a terminal or RStudio.


 ----- 
Richard Stallman is not affected by Godwin's Law. 
 ------ 
    \   
     \
                    @@@@@@ @
                  @@@@     @@
                 @@@@ =   =  @@ 
                @@@ @ _   _   @@ 
                 @@@ @(0)|(0)  @@ 
                @@@@   ~ | ~   @@
                @@@ @  (o1o)    @@
               @@@    #######    @
               @@@   ##{+++}##   @@
              @@@@@ ## ##### ## @@@@
              @@@@@#############@@@@
             @@@@@@@###########@@@@@@
            @@@@@@@#############@@@@@
            @@@@@@@### ## ### ###@@@@
             @ @  @              @  @
               @                    @

Colors cannot be applied in this environment :( Try using a terminal or RStudio.

 -------------- 
hell no! 
 --------------
    \
      \
        \
            |\___/|
          ==) ^Y^ (==
            \  ^  /
             )=*=(
            /     \
            |     |
           /| | | |\
           \| | |_|/\
      jgs  //_// ___/
               \_)
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.
Warning message:
In say("hell no!", type = "warning") : 
 -------------- 
hell no! 
 --------------
    \
      \
        \
            |\___/|
          ==) ^Y^ (==
            \  ^  /
             )=*=(
            /     \
            |     |
           /| | | |\
           \| | |_|/\
      jgs  //_// ___/
               \_)
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.
[1] "\n -------------- \nhell no! \n --------------\n    \\\n      \\\n        \\\n            |\\___/|\n          ==) ^Y^ (==\n            \\  ^  /\n             )=*=(\n            /     \\\n            |     |\n           /| | | |\\\n           \\| | |_|/\\\n      jgs  //_// ___/\n               \\_)\n  "
Colors cannot be applied in this environment :( Try using a terminal or RStudio.

 -------------- 
Ivo Welch: Thanks. I will put in a suggestion that the docs refer to q() in 'see also' for 'stop'.
Brian D. Ripley: I don't think anyone else is confusing 'exit' with 'stop', though. I hope you don't when driving ....
 Ivo Welch and Brian D. Ripley
 R-help
 March 2004 
 --------------
    \
      \
        \
            |\___/|
          ==) ^Y^ (==
            \  ^  /
             )=*=(
            /     \
            |     |
           /| | | |\
           \| | |_|/\
      jgs  //_// ___/
               \_)
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.

 -------------- 
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 
 --------------
    \
      \
        \
            |\___/|
          ==) ^Y^ (==
            \  ^  /
             )=*=(
            /     \
            |     |
           /| | | |\
           \| | |_|/\
      jgs  //_// ___/
               \_)
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.

 -------------- 
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 
 --------------
    \
      \
        \
            |\___/|
          ==) ^Y^ (==
            \  ^  /
             )=*=(
            /     \
            |     |
           /| | | |\
           \| | |_|/\
      jgs  //_// ___/
               \_)
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.

 -------------- 
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 
 --------------
    \
      \
        \
            |\___/|
          ==) ^Y^ (==
            \  ^  /
             )=*=(
            /     \
            |     |
           /| | | |\
           \| | |_|/\
      jgs  //_// ___/
               \_)
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.

 -------------- 
What we have is nice, but we need something very different.
 Robert Gentleman
 Statistical Computing 2003, Reisensburg
 June 2003 
 --------------
    \
      \
        \
            |\___/|
          ==) ^Y^ (==
            \  ^  /
             )=*=(
            /     \
            |     |
           /| | | |\
           \| | |_|/\
      jgs  //_// ___/
               \_)
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.

 -------------- 
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 
 --------------
    \
      \
        \
            |\___/|
          ==) ^Y^ (==
            \  ^  /
             )=*=(
            /     \
            |     |
           /| | | |\
           \| | |_|/\
      jgs  //_// ___/
               \_)
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.


 ----- 
All Glory to the HYPNO TOAD! 
 ------
    \          ,'``.._   ,'``.
     \        :,--._:)\,:,._,.:
      \       :`--,''   :`...';\
               `,'       `---'  `.
               /                 :
              /                   \
            ,'                     :\.___,-.
           `...,---'``````-..._    |:       \
             (                 )   ;:    )   \  _,-.
              `.              (   //          `'    \
               :               `.//  )      )     , ;
             ,-|`.            _,'/       )    ) ,' ,'
            (  :`.`-..____..=:.-':     .     _,' ,'
             `,'\ ``--....-)='    `._,  \  ,') _ '``._
          _.-/ _ `.       (_)      /     )' ; / \ \`-.'
         `--(   `-:`.     `' ___..'  _,-'   |/   `.)
             `-. `.`.``-----``--,  .'
               |/`.\`'        ,','); SSt
                   `         (/  (/
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.

  
 -------------- 
Hello world! 
 --------------
    \
      \
        \
          _____
       .'` ,-. `'.
      /   ([ ])   \
     /.-""`(`)`""-.\
      <'```(.)```'>
      <'```(.)```'>
       <'``(.)``'>
   sk   <``\_/``>
         `'---'`
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.

    
 -------------- 
Q: What do you call a solitary shark
A: A lone shark 
 --------------
    \
      \
        \
              /""-._
              .       '-,
               :          '',
                ;      *     '.
                 ' *         () '.
                   \               \
                    \      _.---.._ '.
                    :  .' _.--''-''  \ ,'
        .._           '/.'             . ;
        ; `-.          ,                \'
         ;   `,         ;              ._\
          ;    \     _,-'                ''--._
          :    \_,-'                          '-._
          \ ,-'                       .          '-._
          .'         __.-'';            \...,__       '.
        .'      _,-'        \              \   ''--.,__  '\
        /    _,--' ;         \              ;           \^.}
        ;_,-' )     \  )\      )            ;
             /       \/  \_.,-'             ;
            /                              ;
         ,-'  _,-'''-.    ,-.,            ;      PFA
      ,-' _.-'        \  /    |/'-._...--'
     :--``             )/
  '
  
Colors cannot be applied in this environment :( Try using a terminal or RStudio.

    
 -------------- 
Q: What do you call a single buffalo?
A: A buffalonely 
 --------------
    \
      \
        \
                   _.-````'-,_
         _,.,_ ,-'`           `'-.,_
       /)     (                   '``-.
      ((      ) )                      `\
        \)    (_/                        )\
        |       /)           '    ,'    / \
        `\    ^'            '     (    /  ))
          |      _/\ ,     /    ,,`\   (  "`
          \Y,   |   \  \  | ````| / \_ \
            `)_/      \  \  )    ( >  ( >
                       \( \(     |/   |/
          mic & dwb  /_(/_(    /_(  /_(
    
Colors cannot be applied in this environment :( Try using a terminal or RStudio.


 ----- 
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

cowsay documentation built on Feb. 7, 2020, 1:06 a.m.