Skip to content

Instantly share code, notes, and snippets.

@kdaily
Forked from jimhester/brown_bear.R
Created December 12, 2016 19:24
Show Gist options
  • Save kdaily/98f6f9263cfe9f2659d1eab225ba93ec to your computer and use it in GitHub Desktop.
Save kdaily/98f6f9263cfe9f2659d1eab225ba93ec 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")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment