When using this code in RStudio (as an example):
print("Hello\n World")
I get Hello\n World as the output instead of a line break. Any ideas why?
Thank you!
CodePudding user response:
Use cat()
instead of print()
.
> cat("Hello \n World")
Hello
World
To know more: https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/cat
CodePudding user response:
Another option is using writeLines
:
writeLines("Hello\n World")
#> Hello
#> World
Created on 2022-07-14 by the reprex package (v2.0.1)