knitr::opts_chunk$set( comment = "#>", collapse = TRUE )
cowsay
makes it easy to print messages, warnings, or character strings with various animals and other creatures.
Stable version from CRAN
install.packages("cowsay")
or dev version from GitHub
# install.packages("pak") pak::pak("sckott/cowsay")
library(cowsay)
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 r length(animals)
animals.
The names of the animals:
sort(names(animals))
For example, access the cow
cow <- animal_fetch('cow') cat(cow)
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")
say("boo!", "ghost")
say("nope, don't do that", type = "warning")
There's the special time
, that will print out the time
say("time")
You can use say()
and give back a string, message, or warning
Message
say("hello world", by = "cow")
Warning
say("hello world", by = "cow", type = "warning")
String
say("hello world", by = "cow", type = "string")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.