vroom_format: Convert a data frame to a delimited string

Description Usage Arguments

View source: R/vroom_write.R

Description

This is equivalent to vroom_write(), but instead of writing to disk, it returns a string. It is primarily useful for examples and for testing.

Usage

1
2
3
4
5
6
7
8
9
vroom_format(
  x,
  delim = "\t",
  na = "NA",
  col_names = TRUE,
  escape = c("double", "backslash", "none"),
  quote = c("needed", "all", "none"),
  bom = FALSE
)

Arguments

x

A data frame to write to disk

delim

Delimiter used to separate values. Defaults to \t to write tab separated value (TSV) files.

na

String used for missing values. Defaults to 'NA'.

col_names

Write columns names at the top of the file? Must be either TRUE or FALSE.

escape

The type of escape to use when quotes are in the data.

  • double - quotes are escaped by doubling them.

  • backslash - quotes are escaped by a preceding backslash.

  • none - quotes are not escaped.

quote

How to handle fields which contain characters that need to be quoted.

  • needed - Only quote fields which need them.

  • all - Quote all fields.

  • none - Never quote fields.

bom

If TRUE add a UTF-8 BOM at the beginning of the file. This is recommended when saving data for consumption by excel, as it will force excel to read the data with the correct encoding (UTF-8)


vroom documentation built on Aug. 27, 2020, 9:07 a.m.