When printing whitespace, some applications will ignore or remove the whitespace, for example it will simplify " " to " ". In this instance, it will be useful to replace the double whitespace with a space preceding by "symbol" (or the other way round conditionally).

set_whitespace(x, symbol = " ")

Arguments

x

vector of character strings to set the whitespace for

symbol

character string to be used as the whitespace. In general, for HTML output (default), use " " and for LaTeX, use "\\\\quad" (the double escape is required)

Examples

x <- c(" a", "b ", " c ") set_whitespace(x)
#> [1] "&emsp; a" "b&emsp; " "&emsp; c&emsp; "