Write lines of text to a file in R

file-io, r

Solution

fileConn<-file("output.txt")
writeLines(c("Hello","World"), fileConn)
close(fileConn)

Problem

In the R scripting language, how do I write lines of text, e.g., the following two lines ``` Hello World ``` to a file named "output.txt"?

Original source