Learn R Programming

tis (version 1.39)

csv: Writes a CSV (comma separated values) file.

Description

Write a matrix or Time Indexed Series to a .csv file that can be imported into a spreadsheet.

Usage

csv(z, file = "", noDates = FALSE, row.names = !is.tis(z), ...)

Arguments

z

matrix or tis object

file

either a character string naming a file or a connection. If "", a file name is constructed by deparsing z. The extension ".csv" is appended to the file name if it is not already there.

noDates

logical. If FALSE (the default) and z is a tis object, the first column of the output file will contain spreadsheet dates.

row.names

either a logical value indicating whether the row names of z are to be written along with z, or a character vector of row names to be written. If FALSE (the default) and z is a tis object, the first column of the output file will contain spreadsheet dates.

other arguments passed on to write.table.

Value

csv returns whatever the call to write.table returned.

Details

csv is essentially a convenient way to call write.table. If file is not a connection, a file name with the ".csv" extension is constructed. Next, a column of spreadsheet dates is prepended to z if necessary, and then csv calls

write.table(z, file = filename, sep = ",", row.names = !is.tis(z), ...)

See Also

write.table