将文本行写入 R 中的文件 [英] Write lines of text to a file in R
本文介绍了将文本行写入 R 中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 R 脚本语言中,我如何编写文本行,例如下面两行
In the R scripting language, how do I write lines of text, e.g. the following two lines
Hello
World
到名为output.txt"的文件?
to a file named "output.txt"?
推荐答案
fileConn<-file("output.txt")
writeLines(c("Hello","World"), fileConn)
close(fileConn)
这篇关于将文本行写入 R 中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文