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

Description Usage Arguments Value See Also Examples

View source: R/csv.R

Description

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

Usage

1
2
## 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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))

csv documentation built on July 1, 2020, 10:27 p.m.

Related to as.csv.data.frame in csv...