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

convert_newlines_to_linebreaks

Replace the newline character with a line break


Description

Replace the newline character with a line break

Usage

convert_newlines_to_linebreaks(text)

Arguments

text

A character vector

Examples

styler:::convert_newlines_to_linebreaks("x\n2")
# a simple strsplit approach does not cover both cases
unlist(strsplit("x\n\n2", "\n", fixed = TRUE))
unlist(strsplit(c("x", "", "2"), "\n", fixed = TRUE))
styler:::convert_newlines_to_linebreaks(c("x", "2"))

styler

Non-Invasive Pretty Printing of R Code

v1.4.1
MIT + file LICENSE
Authors
Kirill Müller [aut], Lorenz Walthert [cre, aut]
Initial release

We don't support your browser anymore

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