raw_string: Print a character vector in its raw form

Description Usage Arguments Examples

View source: R/data-structure.R

Description

The function raw_string() assigns the class xfun_raw_string to the character vector, and the corresponding printing function print.xfun_raw_string() uses cat(x, sep = '\n') to write the character vector to the console, which will suppress the leading indices (such as [1]) and double quotes, and it may be easier to read the characters in the raw form (especially when there are escape sequences).

Usage

1
2
3
4
raw_string(x)

## S3 method for class 'xfun_raw_string'
print(x, ...)

Arguments

x

For raw_string(), a character vector. For the print method, the raw_string() object.

...

Other arguments (currently ignored).

Examples

1
2
3
library(xfun)
raw_string(head(LETTERS))
raw_string(c("a \"b\"", "hello\tworld!"))

yihui/xfun documentation built on Nov. 18, 2018, 4:11 p.m.