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.
vroom_format(x, delim = "\t", na = "NA", col_names = TRUE,
escape = c("double", "backslash", "none"), quote = c("needed", "all",
"none"), bom = FALSE)
A data frame to write to disk
One of more characters used to delimiter fields within a
record. If NULL
the delimiter is guessed from the set of c(",", "\t", " ", "|", ":", ";", "\n")
.
Character vector of strings to interpret as missing values. Set this
option to character()
to indicate no missing values.
Either TRUE
, FALSE
or a character vector
of column names.
If TRUE
, the first row of the input will be used as the column
names, and will not be included in the data frame. If FALSE
, column
names will be generated automatically: X1, X2, X3 etc.
If col_names
is a character vector, the values will be used as the
names of the columns, and the first row of the input will be read into
the first row of the output data frame.
Missing (NA
) column names will generate a warning, and be filled
in with dummy names X1
, X2
etc. Duplicate column names
will generate a warning and be made unique with a numeric prefix.
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.
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.
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)