Can be used in user-defined print() methods to return silently generated strings, or print them.

print_string(string, silent = NULL)

Arguments

string

A single character.

silent

TRUE or FALSE which indicates if to return string silently or print it. The default value is FALSE.

Value

If silent is TRUE, string is returned. And if silent is FALSE, string is printed, and invisible string is returned.

Examples

s <- "I'm a string." # print `s` print_string(s)
#> I'm a string.
# return `s` print_string(s, TRUE)
#> [1] "I'm a string."