Is there an R equivalent for Environment.NewLine in .NET?
I'm looking for a character object that would represent a new line based on the environment, e.g. CR LF ("\r\n") on Windows and LF ("\n") on Unix. I couldn't find any such thing in the R documentation, or the default R options.
There’s no equivalent, but most of the time you won’t need it: as long as you’re writing to a text connection, the operating system will do the correct thing and treat '\n'
according to the platform’s specification; for example, the documentation of writeLines
says:
Normally
writeLines
is used with a text-mode connection, and the default separator is converted to the normal separator for that platform (LF on Unix/Linux, CRLF on Windows).