r - How can I suppress ending newline in write()? -


when doing

write("hello", file = "test.txt") 

and open file test.txt in text editor, contains 2 rows (where second empty). how can suppress write() inserting ending newline command?

write wrapper cat. if use cat this, got same result:

cat("hello",file="test.txt",sep="\n") 

if use cat without sep argument, have text without new line:

cat("hello",file="test.txt") 

another way writing using cat + sink:

sink("test.txt") cat("hello") sink() 

for suppress write() don't find way.


Comments