Author: 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, and Philipp Boersch-Supan
Date: 2025-10-28

# Introduction to cowsay

#### 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, and Philipp Boersch-Supan

#### 2025-10-28

`cowsay` makes it easy to print messages, warnings, or character strings with various animals and other creatures.

## Installation

Stable version from CRAN

    install.packages("cowsay")

or dev version from GitHub

    # install.packages("pak")
    pak::pak("sckott/cowsay")

    library(cowsay)

## The animals

The animals, and other ascii creatures, are all in a single named character vector that is exported from the package. Thus, you can access each animal yourself, and do whatever you want with it.

As of this writing, there are 59 animals.

The names of the animals:

    sort(names(animals))
    #> NULL

For example, access the cow

    cow <- animal_fetch('cow')
    cat(cow)
    #>
    #>         ^__^
    #>         (oo)\ ________
    #>         (__)\         )\ /\
    #>              ||------w|
    #>              ||      ||

## Say something

We expose the function `say()` in this package, which you can use to envoke any animal in the package, and make it say whatever you want. Some examples:

    say("why did the chicken cross the road", "chicken")
    #>
    #>  ____________________________________
    #> < why did the chicken cross the road >
    #>  ------------------------------------
    #>       \
    #>        \
    #>          _
    #>        _/ }
    #>       `>' \
    #>       `|   \
    #>        |   /'-.     .-.
    #>         \'     ';`--' .'
    #>          \'.    `'-./
    #>           '.`-..-;`
    #>             `;-..'
    #>             _| _|
    #>             /` /` [nosig]

    say("boo!", "ghost")
    #>
    #>  ______
    #> < boo! >
    #>  ------
    #>   \
    #>    \
    #>
    #>      .-.
    #>     (o o)
    #>     | O \
    #>      \   \
    #>       `~~~' [nosig]

    say("nope, don't do that", type = "warning")
    #> Warning in say("nope, don't do that", type = "warning"):
    #>  _____________________
    #> < nope, don't do that >
    #>  ---------------------
    #>       \
    #>        \
    #>
    #>         ^__^
    #>         (oo)\ ________
    #>         (__)\         )\ /\
    #>              ||------w|
    #>              ||      ||

There’s the special `time`, that will print out the time

    say("time")
    #>
    #>  ____________________________
    #> < 2025-10-28 22:59:47.939895 >
    #>  ----------------------------
    #>       \
    #>        \
    #>
    #>         ^__^
    #>         (oo)\ ________
    #>         (__)\         )\ /\
    #>              ||------w|
    #>              ||      ||

## It’s how you say it

You can use `say()` and give back a string, message, or warning

Message

    say("hello world", by = "cow")
    #>
    #>  _____________
    #> < hello world >
    #>  -------------
    #>       \
    #>        \
    #>
    #>         ^__^
    #>         (oo)\ ________
    #>         (__)\         )\ /\
    #>              ||------w|
    #>              ||      ||

Warning

    say("hello world", by = "cow", type = "warning")
    #> Warning in say("hello world", by = "cow", type = "warning"):
    #>  _____________
    #> < hello world >
    #>  -------------
    #>       \
    #>        \
    #>
    #>         ^__^
    #>         (oo)\ ________
    #>         (__)\         )\ /\
    #>              ||------w|
    #>              ||      ||

String

    say("hello world", by = "cow", type = "string")
    #> [1] "\n _____________ \n< hello world >\n ------------- \n      \\\n       \\\n\n        ^__^ \n        (oo)\\ ________ \n        (__)\\         )\\ /\\ \n             ||------w|\n             ||      ||"