escape_lf | R Documentation |
Escapes the POSIX-standard newline control character LF
(aka \n
) which is the standard on Unix/Linux and recent
versions of macOS. Set escape_cr = TRUE
in order to also escape the carriage return character CR
(aka \r
) commonly used on Microsoft Windows.
escape_lf(x, escape_cr = FALSE)
x |
A character vector. |
escape_cr |
Whether or not to also escape the carriage return character |
A character vector of the same length as x
.
Other string functions:
as_chr()
,
as_comment_str()
,
as_line_feed_chr()
,
as_str()
,
capitalize_first()
,
dsv_colnames()
,
enum_str()
,
fuse_regex()
,
prettify_nr()
,
sentenceify()
,
wrap_chr()
library(magrittr)
# read in and print RStudio add-in registration file as-is
text <-
fs::path_package(package = "pal",
"rstudio", "addins.dcf") |>
readr::read_file() %T>%
pal::cat_lines()
# escape newlines and print again
pal::escape_lf(text) |> pal::cat_lines()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.