Skip to content

Instantly share code, notes, and snippets.

@jimhester
Last active May 19, 2017 00:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jimhester/e5c6d6174efb22da9d540cb06ce1b2ac to your computer and use it in GitHub Desktop.
Save jimhester/e5c6d6174efb22da9d540cb06ce1b2ac to your computer and use it in GitHub Desktop.
brown bear brown bear
x <- c("Brown bear", "Red bird", "Yellow duck", "Blue horse", "Green frog", "Purple Cat", "Goldfish", "Teacher")
txt <- capture.output(cat(
sprintf("%s, %s, what do you see?\n I see a %s looking at me.\n", head(x, -1), head(x, -1), tail(x, -1)),
sprintf("Teacher, Teacher what do you see\n I see Children looking at me.\nChildren Children what do you see?\n We see a %s and a Teacher looking at us, that's what we see.",
paste0(collapse = ", ", head(x, -1))), sep = ""))
txt
#> Brown bear, Brown bear, what do you see?
#> I see a Red bird looking at me.
#> Red bird, Red bird, what do you see?
#> I see a Yellow duck looking at me.
#> Yellow duck, Yellow duck, what do you see?
#> I see a Blue horse looking at me.
#> Blue horse, Blue horse, what do you see?
#> I see a Green frog looking at me.
#> Green frog, Green frog, what do you see?
#> I see a Purple Cat looking at me.
#> Purple Cat, Purple Cat, what do you see?
#> I see a Goldfish looking at me.
#> Goldfish, Goldfish, what do you see?
#> I see a Teacher looking at me.
#> Teacher Teacher what do you see
#> I see Children looking at me.
#> Children Children what do you see?
#> We see a Brown bear, Red bird, Yellow duck, Blue horse, Green frog, Purple Cat, Goldfish and a Teacher looking at us, that's what we see.
system2("say", shQuote(paste0(txt, collapse = "\n")))
@jimmyodonnell
Copy link

As a new dad who has now read this book many times, I thank you for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment