cowsay

knitr::opts_chunk$set(
  comment = "#>",
  collapse = TRUE
)

cran checks R-check codecov rstudio mirror downloads cran version

What is this?

If you are familiar with cowsay on the cli, then you know what this is, but for R. If not, read below. Why? Why not?

Contributors (alphabetical)

peeps <- c(
  "Scott Chamberlain",
  "Tyler Rinker",
  "Thomas Leeper",
  "Noam Ross",
  "Rich FitzJohn",
  "Kiyoko Gotanda",
  "Carson Sievert",
  "Andy Teucher",
  "Karl Broman",
  "Franz-Sebastian Krah",
  "Lucy D'Agostino McGowan",
  "Guangchuang Yu",
  "Paolo Sonego",
  "Philipp Boersch-Supan",
  "Andreas Brandmaier",
  "Amanda Dobbyn",
  "Marion Louveaux"
)
cat(c("", sort(peeps)), sep = "\n * ")

That's right, it takes r length(peeps) people to make cowsay - it's that hard.

Contributing

See CONTRIBUTING.md

Where to find ASCII animal art

Sources to look in:

Permissions

In the ascii art mailing list https://groups.google.com/forum/#!forum/alt.ascii-art they say:

 As for posting other people's ASCII art,
    after a discussion in news:alt.ascii-art       _     ___
    the following rules were agreed upon:         #_~`--'__ `===-,
    1.  If an ASCII ART picture has initials      `.`.     `#.,//
        on it, leave them on when posting it      ,_\_\     ## #\
    2.  If an ASCII ART picture doesn't have      `__.__    `####\
        initials on it,  mention  that  you            ~~\ ,###'~
        didn't  draw  it  when  posting  it.              \##'
    3.  If somebody  posts a picture without                  [nosig]
        initials and you have an original copy
        with initials on, feel free to re-post the original version.
        *   The re-post ought not to be taken personally, as we all
            know that ASCII art often loses proper credits.
            Responses to the re-post are not necessary.

    One contributor, name of Krogg, suggested the following:

    1.) Ultra polite:...ya make yer own ascii and use it.
    2.)  Very polite:...Ya contact the author and ask if ya
                        can use it...
    3.)       polite:...Ya use it but you keep the Credits
                        in there like they should be.
    4.)         rude:...Ya use it and strip credits.
    5.)    Very rude:...Ya use it and claim that it Is
                        _Your_ very own creation...

So, let's go with this rule: Let's include found (on the web) ascii art in this pkg, include signature if there, and if no signature, put in a [nosig] (see above).

Quick watch start

Asciicast: https://asciinema.org/a/7745

Install

From CRAN

install.packages("cowsay")

Dev version

remotes::install_github("sckott/cowsay")
library("cowsay")

The animals

sort(names(animals))

Say Something

say('time')
say("ain't that some shit", "chicken")

Add some color:

library(crayon)
say("boo!", "ghost", 
    what_color = "cyan", by_color = "saddlebrown")

ghost

say("I love hooo you are!", "owl", 
    what_color = rgb(0, 1, 1), by_color = "#FF0000")

owl

String styles together crayon-style:

say(what = "rms", by = "rms", 
        what_color = yellow$bgMagenta$bold,
        by_color = cyan$italic)

rms

This doesn't preclude you from adding extra crayon colors to your what string directly.

say(what = paste0("hello ", crayon::yellow("there "), crayon::underline("world")), 
    by = "trilobite", 
    what_color = bgBlue$cyan$italic,
    by_color = "thistle")  # Don't ask me why "thistle" is pink/purple

trilobite

Vary type of output, default calls message()

say("hell no!")
say("hell no!", type="warning")
say("hell no!", type="string")

Catfacts!!!!

From the catfacts API at https://catfact.ninja

say("catfact", "cat")
#> --------------
#> When a domestic cat goes after mice, about 1 pounce in 3 results in a catch.
#> --------------
#>    \
#>      \
#>        \
#>            |\___/|
#>          ==) ^Y^ (==
#>            \  ^  /
#>             )=*=(
#>            /     \
#>            |     |
#>           /| | | |\
#>           \| | |_|/\
#>      jgs  //_// ___/
#>               \_)

Long cat

From the a Boing Boing tweet on 2014-05-10 "twitter.com/BoingBoing/status/465170473194512384" (post may be gone)

say("it's caturday", "longcat")

Grumpy cat

say('NO!', by='grumpycat')
say('WOKE UP TODAY, IT WAS TERRIBLE', by='grumpycat')
say('I HAD FUN ONCE, IT WAS AWFUL', by='grumpycat')

Bunny Holding a sign

say(by='signbunny')

Fish

say(by='fish')

R fortunes

say('fortune','cat')

You can also pick a particular fortune by number or regex search - if the fortune parameter is not NULL you don't have pass anything to the what parameter (the 1st parameter)

say(fortune=100)
say(fortune='whatever')

Trilobite

say("Hi there :)", 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")

Yoda

say("fortune", by = "yoda")

Bats!

say("hi, i'm a bat", by="bat")

See also bat2

Monkey!

say("fortune", by = "monkey")

Daemon!

say("fortune", by = "daemon")

Egret

say("je ne regrette rien", by = "egret")

See also bat2

Endless horse

endless_horse()
## -----
## Hello world!
## ------
##    \
##     \
##      \
##       ,
##    _,,)\.~,,._
##     (()`  ``)\))),,_
##      |     \ ''((\)))),,_          ____
##      |6`   |   ''((\())) "-.____.-"    `-.-,
##      |    .'\    ''))))'                  \)))
##      |   |   `.     ''                     ((((
##      \, _)     \/                          |))))
##       `'        |                          (((((
##                 \                  |       ))))))
##                  `|    |           ,\     /((((((
##                   |   / `-.______.<  \   |  )))))
##                   |   |  /         `. \  \  ((((
##                   |  / \ |           `.\  | (((
##                   \  | | |             )| |  ))
##                    | | | |             || |  '   [endless.horse]
##                    | | | |             || |
##
##                    | | | |             || |
##                    | | | |             || |
##                    | | | |             || |
##                    | | | |             || |
##                    | | | |             || |
##                    | | | |             || |
##                    | | | |             || |
##                    | | | |             || |
##                    | | | |             || |
##                    | | | |             || |

Using pipes

library("magrittr")
"I HAD FUN ONCE, IT WAS AWFUL" %>% say('grumpycat')

I just want the animals!

Okay, hold your endless horses. Just use the exported vector animals, and you can select the animal you want by name.

animals['clippy']

Meta



sckott/cowsay documentation built on Nov. 6, 2023, 1:54 p.m.