write_csv_fi: write_csv_fi

View source: R/write_csv_fi.R

write_csv_fiR Documentation

write_csv_fi

Description

Save any list like data.frame, data.table or matrix to a txt-file. Uses readr::write_excel_csv2.

Usage

write_csv_fi(
  x,
  path = ".",
  na = "",
  delim = "\t",
  quote_escape = "double",
  append = FALSE,
  col_names = !append
)

Arguments

x

Any list like element e.g. data.frame and data.table.

path

Path or connection to write to.

na

String used for missing values. Defaults to "". Missing values will never be quoted; strings with the same value as na will always be quoted.

delim

SDelimiter used to separate values. Defaults to "tab"

quote_escape

The type of escaping to use for quoted values, one of "double", "backslash" or "none". Defaults to "double".

append

If FALSE, will overwrite existing file. If TRUE, will append to existing file. In both cases, if file does not exist a new file is created.

col_names

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

Examples

n <- c(1.1, 2.2, 3.3)
s <- c("a", "b", "c")
x <- data.frame(n, s)
write_csv_fi(x, file = "example.txt")

JouniVatanen/jmisc documentation built on Jan. 25, 2023, 8:41 p.m.