从 R 中导出竖线分隔的文本文件

Export Pipe Delimited Text File From R

我需要导出以“|”分隔的竖线来自 [R] 脚本的 txt 文件。

谢谢!

斯科蒂

函数 write.table 提供参数 sep 来定义分隔符。

使用 sep = "|"| 字符分隔单元格,例如:

write.table(data.frame(a=1:3,b=3:1), file = "output.txt", sep = "|")

Tidyverse 解决方案是使用 write_delim():

write_delim(my_table, data/my_table.txt, delim = "|")

查看文档 here