as.csv.data.frame: Save a Data Frame as CSV.

View source: R/csv.R

as.csv.data.frameR Documentation

Save a Data Frame as CSV.

Description

Saves a data.frame as CSV, using selected conventions.

Usage

## S3 method for class 'data.frame'
as.csv(x, file, na = ".", quote = FALSE, auto = !quote, row.names = FALSE, ...)

Arguments

x

data.frame

file

passed to write.csv

na

passed to write.csv

quote

passed to write.csv

auto

double-quote column names and row values with embedded commas or double-quotes; the latter are escaped by doubling them

row.names

passed to write.csv

...

passed to write.csv if accepted by write.table

Value

invisible data.frame (x)

See Also

Other as.csv: as.csv.character(), as.csv()

Examples

x <- data.frame(
  check.names = FALSE,
  stringsAsFactors = TRUE,
  person = 1:3, 
  `name, suffix` = c("Bill Smith", 'Joseph "Joe" Hancock', "Mary Laguire, DDS")
)
file <- tempfile()
as.csv(x,file)
y <- as.csv(file,as.is=FALSE)
attr(y,'source')
attr(y,'source') <- NULL
x
y
stopifnot(identical(x,y))

bergsmat/csv documentation built on July 9, 2022, 11:51 a.m.