as.csv: Read or Write CSV Using Selected Conventions

Description Usage Arguments See Also Examples

View source: R/csv.R

Description

Reads or writes CSV files in a conventional way. Generic, with methods for character and data.frame. A length-one character argument is treated as a filepath and tries to return a data.frame. A data.frame argument is written to the specified filepath. Typically, quote and row.names are FALSE and na is ".". When reading, white space and empty strings are treated as NA, and strip.white is TRUE. When writing, values with commas or double-quotes are double-quoted (and embedded double-quotes are doubled).

Usage

1
as.csv(x, ...)

Arguments

x

object

...

passed arguments

See Also

as.csv.character, as.csv.data.frame

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

Examples

1
2
3
4
data <- head(Theoph)
filepath <- file.path(tempdir(),'theoph.csv')
as.csv(data,filepath)
as.csv(filepath)

Example output

  Subject   Wt Dose Time  conc
1       1 79.6 4.02 0.00  0.74
2       1 79.6 4.02 0.25  2.84
3       1 79.6 4.02 0.57  6.57
4       1 79.6 4.02 1.12 10.50
5       1 79.6 4.02 2.02  9.66
6       1 79.6 4.02 3.82  8.58

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

Related to as.csv in csv...