跳转至内容

将 CSV 文件写入磁盘

用法

write_csv_arrow(
  x,
  sink,
  file = NULL,
  include_header = TRUE,
  col_names = NULL,
  batch_size = 1024L,
  na = "",
  write_options = NULL,
  ...
)

参数

x

data.frameRecordBatchTable

sink

字符串文件路径、连接、URI 或 OutputStream,或文件系统 (SubTreeFileSystem) 中的路径

file

文件名。指定此参数或 sink,但不能同时指定两者。

include_header

是否写入带有列名的初始标题行

col_names

include_header 相同。指定此参数或 include_headers,但不能同时指定两者。(译注:原文疑似笔误,应为`include_header`)

batch_size

一次处理的最大行数。默认为 1024。

na

要写入 NA 值的值。不能包含引号。默认为 ""

write_options

参见 CSV 写入选项

...

其他参数

返回值

输入的 x,不可见。请注意,如果 sinkOutputStream,则流将保持打开状态。

示例

tf <- tempfile()
on.exit(unlink(tf))
write_csv_arrow(mtcars, tf)