Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

raw_string

Print a character vector in its raw form


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

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

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

xfun

Miscellaneous Functions to Support Packages Maintained by 'Yihui Xie'

v0.22
MIT + file LICENSE
Authors
Yihui Xie [aut, cre, cph] (<https://orcid.org/0000-0003-0645-5666>), Wush Wu [ctb], Daijiang Li [ctb], Xianying Tan [ctb], Salim Brüggemann [ctb] (<https://orcid.org/0000-0002-5329-5987>), Christophe Dervieux [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.