Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以使用 R 打印文件的内容(支持 r、tex、txt、rnw 等扩展名)?
可复制文件:
sink('myFile') cat('\nThis is some text') cat('\n') cat('\nEnd of file') sink()
现在我正在寻找 R 中的一个函数,它将 R 的内容打印为...
>PRINT_FILE_CONTENT('myFile') This is some text End of file >
我希望我很清楚。我将不胜感激任何帮助?
这似乎有效:
cat(readLines("myFile"),sep="\n")
虽然我确实得到了
Warning message: In readLines("myFile") : incomplete final line found on 'myFile'
最后......suppressWarnings()如果你愿意,你可以把它包起来。
suppressWarnings()