Skip to contents

Thought/speech bubble/balloon

Usage

bubble_say(x, width = 60)

bubble_think(x, width = 60)

Arguments

x

(character) a character vector

width

(integer/numeric) width of each line. default: 60

Value

character vector of length greater than the input x

Details

bubble_say gives the traditional bubble that you get when you run cowsay on the command line, with carrots or slashes for the sides, while bubble_think gives a slightly different bubble with parens for the sides

See also

Other bubble: bubble_tail()

Examples

library(fortunes)
quote <- as.character(fortune())
bubble_say(x = quote)
#>  [1] ""                                                         
#>  [2] " ______________________________________________________ " 
#>  [3] "/ Warning: Although abusing R was not proved to be     \\"
#>  [4] "| addictive, it should be noted that it often leads to |" 
#>  [5] "| harder stuff.                                        |" 
#>  [6] "| Ivan Mizera (self-confessed abuseR)                  |" 
#>  [7] "| NA                                                   |" 
#>  [8] "| useR! 2006, Vienna                                   |" 
#>  [9] "\\ June 2006                                            /"
#> [10] " ------------------------------------------------------ " 

cat(bubble_say(paste(quote, collapse = " ")), sep = "\n")
#> 
#>  ______________________________________________________ 
#> / Warning: Although abusing R was not proved to be     \
#> | addictive, it should be noted that it often leads to |
#> | harder stuff. Ivan Mizera (self-confessed abuseR) NA |
#> \ useR! 2006, Vienna June 2006                         /
#>  ------------------------------------------------------ 
ch <- animals[["chicken"]]
z <- paste(c(bubble_say(quote), bubble_tail(ch, "\\"), ch), collapse = "\n")
cat(z)
#> 
#>  ______________________________________________________ 
#> / Warning: Although abusing R was not proved to be     \
#> | addictive, it should be noted that it often leads to |
#> | harder stuff.                                        |
#> | Ivan Mizera (self-confessed abuseR)                  |
#> | NA                                                   |
#> | useR! 2006, Vienna                                   |
#> \ June 2006                                            /
#>  ------------------------------------------------------ 
#>       \
#>        \
#>          _
#>        _/ }
#>       `>' \
#>       `|   \
#>        |   /'-.     .-.
#>         \'     ';`--' .'
#>          \'.    `'-./
#>           '.`-..-;`
#>             `;-..'
#>             _| _|
#>             /` /` [nosig]
#>  
if (FALSE) { # rlang::is_installed("fortunes") && interactive()
text_color <- sample(grDevices::colors(), 1)
text_style <- crayon::make_style(text_color)
text_style(bubble_say(quote))
}