Write lines of text to a file in R
Actually you can do it with sink()
:
sink("outfile.txt")
cat("hello")
cat("\n")
cat("world")
sink()
hence do:
file.show("outfile.txt")
# hello
# world
fileConn<-file("output.txt")
writeLines(c("Hello","World"), fileConn)
close(fileConn)