Author: Hannah Yang

We can’t deny the power of mastering a programming language nowadays in the workplace and as a result, there are many kids starting to learn coding in the elementary school. Meanwhile, it’s important to realize the difficulty of programming languages for kids, expecially when they are still learning the basics of math and computers. Thus, it’s important to attract them in a playful way while learning. Here, I’m introducing 2 fun R packages for kids, which can boost their interest in coding while practicing basic skills.

”Cowsay” package

In an enlightenment course, how can we miss cowsay? Cowsay is a program that generates ASCII art pictures of a cow with a message. With Cowsay R package by Scott Chamberlain, we can generate ASCII arts in R easily as well!

After installing the packages, Ther are over 40 animals in the package that can be drew, including cat, alligator, frog, etc. We can check the available animals by calling $names(animals)$

names(animals)

#>  [1] "alligator"    "ant"          "anxiouscat"   "bat"          "bat2"        
#>  [6] "behindcat"    "bigcat"       "buffalo"      "cat"          "chicken"     
#> [11] "chuck"        "clippy"       "cow"          "daemon"       "duck"        
#> [16] "duckling"     "egret"        "endlesshorse" "facecat"      "fish"        
#> [21] "frog"         "ghost"        "goldfish"     "grumpycat"    "hypnotoad"   
#> [26] "longcat"      "longtailcat"  "monkey"       "mushroom"     "owl"         
#> [31] "pig"          "poop"         "pumpkin"      "rabbit"       "shark"       
#> [36] "shortcat"     "signbunny"    "smallcat"     "snowman"      "spider"      
#> [41] "squirrel"     "squirrel2"    "stegosaurus"  "stretchycat"  "trilobite"   
#> [46] "turkey"       "whale"        "wolf"         "yoda"

$cowsay$ exports one function $say$, which allows you to print the messay in a creative way.

library(cowsay)
say("Hello world!")

-------------- 
Hello world! 
 --------------
    \\
      \\
        \\
            |\\___/|
          ==) ^Y^ (==
            \\  ^  /
             )=*=(
            /     \\
            |     |
           /| | | |\\
           \\| | |_|/\\
      jgs  //_// ___/
               \\_)

We can futher specify the animal and colors.

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

Untitled

Multiple colors are even possible (using $multicolor$ package)

say(what = "I'm a rare Irish buffalo",
    by = "buffalo", 
    what_color = c("salmon2", "darkcyan", "salmon2", "darkcyan"),
    by_color = c("green", "white", "orange"))

Untitled

One of my favoriate animal is a long cat in the package!

say("it's caturday", "longcat")
#> 
#>  ----- 
#> it's caturday 
#>  ------ 
#>     \\   
#>      \\
#>     .ハ,,ハ
#>     ( ゚ω゚)
#>     |つ  つ
#>     |    |
#>     |    |
#>     |    |
#>     |    |
#>     |    |
#>     |    |
#>     |    |
#>     |    |
#>     |    |
#>     |    |
#>     |    |
#>     |    |
#>     |    |
#>     |    |
#>     |    |
#>     |    |
#>     |    |
#>     |    |
#>     U "  U
#>         [BoingBoing]
#>

Look how cute and creative it is! I’m sure the kids will fall in love with this package and hang around for quite a while 😺

”Fun” package