
Interlace a deinterlaced data frame and write it to a file
Source:R/write.R
write_interlaced_delim.RdThe write_interlaced_*() family of functions will take a data frame
with interlaced columns, flatten all interlaced columns, then write it to
a file. Non-interlaced columns just pass through. The behavior of these
functions match their similarly named counterparts in readr.
Usage
write_interlaced_delim(
x,
file,
delim = " ",
empty = "NA",
append = FALSE,
col_names = !append,
quote = c("needed", "all", "none"),
escape = c("double", "backslash", "none"),
eol = "\n",
num_threads = readr::readr_threads(),
progress = readr::show_progress()
)
write_interlaced_csv(
x,
file,
empty = "NA",
append = FALSE,
col_names = !append,
quote = c("needed", "all", "none"),
escape = c("double", "backslash", "none"),
eol = "\n",
num_threads = readr::readr_threads(),
progress = readr::show_progress()
)
write_interlaced_csv2(
x,
file,
empty = "NA",
append = FALSE,
col_names = !append,
quote = c("needed", "all", "none"),
escape = c("double", "backslash", "none"),
eol = "\n",
num_threads = readr::readr_threads(),
progress = readr::show_progress()
)
write_interlaced_excel_csv(
x,
file,
empty = "NA",
append = FALSE,
col_names = !append,
quote = c("needed", "all", "none"),
escape = c("double", "backslash", "none"),
eol = "\n",
num_threads = readr::readr_threads(),
progress = readr::show_progress()
)
write_interlaced_excel_csv2(
x,
file,
empty = "NA",
append = FALSE,
col_names = !append,
quote = c("needed", "all", "none"),
escape = c("double", "backslash", "none"),
eol = "\n",
num_threads = readr::readr_threads(),
progress = readr::show_progress()
)
write_interlaced_tsv(
x,
file,
empty = "NA",
append = FALSE,
col_names = !append,
quote = c("needed", "all", "none"),
escape = c("double", "backslash", "none"),
eol = "\n",
num_threads = readr::readr_threads(),
progress = readr::show_progress()
)Arguments
- x
A data frame or tibble to write to disk.
- file
File or connection to write to.
- delim
Delimiter used to separate values. Defaults to
" "forwrite_delim(),","forwrite_excel_csv()and";"forwrite_excel_csv2(). Must be a single character.- empty
String used for empty values (or
NAvalues in non-interlaced columns). Defaults to NA.- append
If
FALSE, will overwrite existing file. IfTRUE, will append to existing file. In both cases, if the file does not exist a new file is created.- col_names
If
FALSE, column names will not be included at the top of the file. IfTRUE, column names will be included. If not specified,col_nameswill take the opposite value given toappend.- quote
How to handle fields which contain characters that need to be quoted.
needed- Values are only quoted if needed: if they contain a delimiter, quote, or newline.all- Quote all fields.none- Never quote fields.
- 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.
- eol
The end of line character to use. Most commonly either
"\n"for Unix style newlines, or"\r\n"for Windows style newlines.- num_threads
Number of threads to use when reading and materializing vectors. If your data contains newlines within fields the parser will automatically be forced to use a single thread only.
- progress
Display a progress bar? By default it will only display in an interactive session and not while knitting a document. The display is updated every 50,000 values and will only display if estimated reading time is 5 seconds or more. The automatic progress bar can be disabled by setting option
readr.show_progresstoFALSE.