Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
166 views
in Technique[技术] by (71.8m points)

Write lines of text to a file in R

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"?

question from:https://stackoverflow.com/questions/65874339/how-to-write-data-to-txt-file-in-r

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
fileConn<-file("output.txt")
writeLines(c("Hello","World"), fileConn)
close(fileConn)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...