When using the print function to print to the screen, I would like one line to appear on one line, and the next line to be on a second line.
with this line
print(
paste(
"hey I want this to be line one", "and this to be line two", "would be great if you could help"
)
)
I want this to print
[1] "hey I want this to be line one
[2] and this to be line two would be great if you could help"
To use a tab separator, use "\t", and use "\n" to create a line break.
Use "\n" to print a line break <a name="use-"\n""> Insert "\n" at the desired line break position.
To break a line in R Markdown and have it appear in your output, use two trailing spaces and then hit return .
The most commonly used are "\t" for TAB, "\n" for new-line, and "\\" for a (single) backslash character.
I assume your sample output should actually be three lines instead of two... You should use cat
instead of print
, and add sep="\n"
to the paste
statement:
cat(paste("hey I want this to be line one",
"and this to be line two",
"would be great if you could help" ,sep="\n"))
Output:
hey I want this to be line one
and this to be line two
would be great if you could help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With