Suppose I am writing a text file using the following code.
df <- iris
write.table(df, "data/iris.txt")
When I open the file in Notepad ++ , it displays CRLF
.
If I replace \n
with \r
, it displays CR
. If I do the opposite, it becomes LF
. So my question is: How can I achieve CR
or LF
or CRLF
directly from the write.table()
( or any other function)?
See https://npp-user-manual.org/docs/searching/#extended-search-mode to know about \n
and \r
.